Problems when trying to update a certain field with AIF

Recently I tried to setup AIF in standard AX 2009. The purpose was to send service orders electronically with AIF, in XML-format and sending it back to AX in order to update the field StageId of the specific service order.

I had managed to send the service order as a XML-file to the outbound map, but I had a problem in reading in the XML in order to update the StageId of the ServiceOrder.
This resulted in an error in AIF Exception log:

The parameter index is not valid.

This is because the update xml message did not contain part

so in this way AIF has no idea which record has to be updated. This is because by adding the searching criteria we enable AIF to search which record should be updated.

This can be solved by adding EntityKeyList tag to xml document

<EntityKeyList xmlns=””>
<EntityKey xmlns=””>

The other problem is that when you look into table SMASalesOrderTable you can find out that field StageId had been set up AllowEditOnCreate: No, which does mean that even using AIF you won’t be able to update this field, as kernel will abandon it.
As you can see in referenced link (Update Action Rules in AIF), full update is deleting and creating new record with new data. So if it is not allowed by data structure to change field during edit or create then AIF will not behave differently.
In our case I could create new operation which will update field StageId in a way to run all needed business logic behind (similar than class SMAStageEngine. Of course there is needed some code changes) and then add it to service.

To learn more how to create new operation please refer to How to add a Service Operation to a Service

Comments (0)

Skip to main content