How to add attachment Note to Transfer Order created via AIF Service in AX 2012 R2

Hi,

I am unable to create and facing below issue while creating the Transfer Order with the Attachment note when the Transfer Order is created via AIF:

→ Field ‘Company account’ must be filled in.

→ Field ‘Reference record ID’ must be filled in.

→ Field ‘Reference table ID’ must be filled in.

Please find the details as below:

  1. Service Order AIF Service has this feature by default but Transfer Order create service does not have this feature.

  2. Since we want this feature on Transfer Order Line level, I duplicated the Transfer Order Create Service and added the DocuRef table as a child of Transfer Order Line with the same details by referring from Service Order Service.

Note: When I am passing the same details for Attachment “note” while creating the Service Order via AIF, I am able to create the Service Order Successfully along with attachment notes.

  1. Now the new Transfer Order create service is created but I am unable to create the transfer order when i am even providing the Attachment “note” details as I am getting the above errors. However when I am not passing the Attachment “note” details, I am able to create the Transfer Order.

Question: I have done modified the Transfer Order Service by referring to the out of box Service Order service to incorporate this feature but I am unable to achieve this. Can anyone please help me troubleshoot this as in where am I supposed to look for in order to get this done?

Would appreciate for quick response.

Regards,

Muneeb

Hi,

I have drilled down to see what extra was done in Service Order Service and found that inside the method ‘PrepareForSave’ of the Class AxdServiceOrder, some code was written.

I have tried the make the same changes in the Transfer Order Service i.e. I wrote the below code in DocuRef Switch case of ‘PrepareForSaveExtended’ of the class AxdNewTransferOrderCreate:


axbc_DocuRef.parmRefCompanyId(axbc_DocuRef.parentAxBC().currentRecord().dataAreaId);

axbc_DocuRef.parmRefRecId(axbc_DocuRef.parentAxBC().currentRecord().RecId);

axbc_DocuRef.parmRefTableId(axbc_DocuRef.parentAxBC().currentRecord().TableId);


After I did the above code changes, out of the 3 errors I was getting, 2 got resolved but below one I am still getting:

→ Field ‘Reference record ID’ must be filled in.

Can anyone please help me out on this as I am stuck up on how to troubleshoot to resolve this error?

would appreciate for your quick help.

Regards,

Muneeb

Why don’t you use debugger to see what’s going on? It’s difficult to tell you what’s wrong in code that we’ve never seen, you don’t tell us where the error is thrown from etc.

Seriously, the debugger is what you need in this moment. Start from the place where the error is thrown and go up to where the value should be set up.

I found the following post helpful for a similar issue.

blogs.msdn.microsoft.com/…/