HistoricalAX 2012

AX 2012: debug the AIF outbound processing service

Two temporary changes to standard AX 2012 code that let you step through AifOutboundProcessingService in the debugger.

AIF was removed as of Dynamics AX 7.0 and replaced by the Data Import/Export framework.

First written
Re-read
Versions
AX 2012

AIF outbound messages are processed under runas, so the debugger never stops in your code. This note bypasses runas and the dispatcher permission check while you debug. AIF itself is gone: it “couldn’t scale to a cloud service” and was removed as of Dynamics AX 7.0, replaced by the Data Import/Export framework (Removed or deprecated features in previous releases).

Then → now: how I build integrations today is in D365FO Integration Architecture, Part 1.

The original note

If you need to go deeper when debugging an outbound message, you have to make a couple of temporary changes to standard code:

  • In AifOutboundProcessingService.runAsUserInPartition, comment out the runas call and replace it with a direct call to processAsUser:
/*
// runAs currentUser and process all messages in the container.
new RunAsPermission(runAsUserId).assert();

// BP deviation documented
runas(runAsUserId,
    classnum(AifOutboundProcessingService),
    staticmethodstr(AifOutboundProcessingService, processAsUser),
    messageIdContainer,
    runAsCompany,
    '',
    runAsPartition);

// Revert the permission
CodeAccessPermission::revertAssert();
*/

AifOutboundProcessingService::processAsUser(messageIdContainer);

Important: you have to run the code in the same company and partition given in the runAsCompany and runAsPartition parameters.

  • In AifDispatcher.dispatchOperation, comment out (or skip) this line:
//new AifDispatcherPermission().demand();

To process the message queue, use new AifOutboundProcessingService().run().

References