Send the item master to a 3PL in AX 2012

So this post didn’t end up exactly the way I thought it would when I started it. Earlier this week we were talking about setting up integration with a 3PL, and we need to send that company a copy of the item master from one of our Dynamics AX companies. I remembered doing this a year or so ago for another company which was integrating Dynamics AX with a manufacturing shop floor production control system. My memory was that we’d used a standard Dynamics AX function with no customisation – but my memory was playing tricks, we’d done three minor enhancements to the standard process, which I’ll mention as we walk through the setup and process.

There’s a standard function that can send your items as an XML message, and the first thing that we need to do is to deploy that service as a Service group. Open the AOT and create a new Service group:

Then drag the Service InventItemService into that group, giving:

And then Right-click > Deploy the service group – that can take a while. Then close the AOT.

Now we need an outbound port. Systems administration > Setup > Services and Application Integration Framework > Outbound ports:

For this port I’m using a folder (and the File system adapter) and, as you can see above, I’ve created a folder I can write these outbound messages to. Next click on Service operations and select the InventItemService.find service operation:

Close the Select service operations window and tick the ‘Customise documents’ checkbox and click on the Data policies button, and a form opens which allows you to select which fields are going to be exported:

However, there are a few fairly glaring omissions from this service: the item name (which of course is held on the Product master); and Barcodes; and Product dimensions (config, size, colour, style, if you’re’ using those). There are separate AIF services for Barcodes and Products, but the best action here is to customise this service to add in any ‘missing’ fields which you require. In case you’re counting, that’s the second customisation.

There aren’t a lot of other setup options:

I’ve added logging but probably that’s not necessary. OK. Activate the outbound port:

Next navigate to your items, Product information management > Common > Released products, and click on the ‘General’ action tab, and click on the ‘Send …’ button.

Incidentally, if you haven’t done the setup above, when you click the send button you’ll see an error message like this:

But if everything is setup correctly you’ll get:

The first time you open this form you’ll have to select your Outbound port name (which of course defines the folder you’re writing to). Then you have to setup the filter query to select the items which will be exported, and oddly this form doesn’t remember the filter query you previously used; nor does it default to the item selected when you click the Send button, and it doesn’t have a Batch tab to setup this function up as a recurring batch job. That’s the third customisation that’s required. Set your filter and click the OK button:

The system writes a trigger record into the AIF queue. Systems administration > Inquires > Services and Application Integration Framework > Queue manager:

AIF messages are processed by an AIF batch job, and this consists of four batch tasks. As I’ve said before there’s a good example of the batch job you need in the demo data. Systems administration > Inquires > Batch jobs > Batch jobs:

(If you setup your own job remember to setup the processing conditions so that the tasks process one after another in this sequence).

So we wait for the job to run, and hey presto a file appears in our outbound folder:

It’s an XML file with a unique date/time stamp file name. In this case the message looks like this:

If you don’t have a taste for the customisations required to export additional fields and convert this function to a recurring batch job check out this post: A simple outbound interface for Dynamics AX 2012.