Greg On Dynamics Ax

Random thoughts about development using Dynamics AX and .Net

Top 5 AIF Development Tips and Tricks

with 2 comments

1. Enable the debugger

You will notice, if you put a breakpoint into your document class, that when you run the associated action, the breakpoint will get ignored – leaving you in the dark. This is because the action is called using a ‘runas’ function call  to change the user executing the code.

To workaround this replace the runas method calls with direct calls in\Classes\AifOutboundProcessingService\ and \Classes\AifInboundProcessingService, eg:

staticmethodstr(AifInboundProcessingService, processAsUser),
[message.pack(), messageId]);
AifInboundProcessingService::processAsUser([message.pack(), messageId]);

2. Run jobs instead of waiting for batch processing

The usual way for the AIF to run is using the batch processing framework, where you setup an interval for the inbound and outbound processing  to run.  This minute or so can feel like an age when you are in the middle of developing:

AIF batch processing

AIF batch processing

So use a custom job to have the AIF run instantly at the click of a button, here is an example of the receive job:

static void runAIFReceive(Args _args)
AifGatewayReceiveService aifGatewayReceiveService;
AifInboundProcessingService aifInboundProcessingService;

aifGatewayReceiveService = new AifGatewayReceiveService();;
aifInboundProcessingService = new AifInboundProcessingService();;  // pass true for debug mode

3. Use file adapters


When using the AIF, you will most likely be using a Biztalk, Web service or MSMQ adapter. Testing actions using one of these adapters can be a pain as you will most likely require another program to send or receive the message.

To get around this you can use a file adapter during testing, so that you can just write the message in plain XML and drop the file into a directory on your file system to be processed.

Then when you are finished testing / developing you can easily swap the file adapter out.

4. Compose messages with the Visual Studio XML editor

During development (when you use a file adapter), you can create the message using notepad or any other text editor. I recommend using the Visual Studio XML editor to quickly compose these to take advantage of intellisense, schema validation and other useful features (like inserting a guid):


5. Use the pipeline

It is unlikely (if you are integrating with a third party) that the XML schemas  of the external system match those in AX.

To transform the message into the format AX can handle you can use the pipeline to add a component to run an xslt on the inbound XML:


You can also create custom pipeline components, see this link for more information –

How Do I: Create a Custom AIF Pipeline Component?


Written by gregondax

September 24, 2009 at 1:23 pm

2 Responses

Subscribe to comments with RSS.

  1. […] a comment » In my last post (Top 5 AIF Development Tips and Tricks) I mentioned how you can use the AIF to transform external messages into the format that AX […]

  2. You created some quite points there. I did a search on special topic also to found most folks will agree with your blog.

    Daniel Feller

    May 5, 2010 at 1:04 am

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: