How to call a custom method on Table level from the AIF Service [AX 2012 R2 CU7]

Hi,

I am working on AX 2012 R2 CU7. I am stuck up in the below issue:

  1. I have a method called ‘AAA’ on table level[SMAServiceOrderTable]. Now when I am calling Service Order service from outside AX to create Service Order in AX, I want to execute the logic inside ‘AAA’ when the Service Order service is called.

Question; Where can I call this ‘AAA’ method from so that this method will be called when the Service Order Service is called. I tried to call this method from “prepareForSave” method on AxdServiceOrder class but no success.

Can anyone please help me out on the above issue. As there is little urgency, I would really appreciate if someone can help me out at the earliest.

Would really appreciate for a quick help. Thanks in advance.

Regards,

Muneeb

You can call it from any method in the document class where it makes sense. prepareForSave() surely is called by the framework if the document is being saved. If you call a right operation, you’ll have to do at least basic debugging; saying “but no success” is not a description of a problem that we can deal with. The debugger will help you with this task (don’t forget that services run in CIL, therefore you have to use the Visual Studio debugger).

Hi Martin,

Thank you so much for your help.

I found the solution for the above issue I faced.

Thank you so much once again.

Regards,

Muneeb

Hi Muneeb,

I am facing the same issue. Actually I am calling a Batch class in prepareForSaveExtended method.

Please let me know how you call the custom method in service class.

Regards,

Janak Talekar

Hi Janak,

Thank you.

Can you please let me know the scenario that would help me provide you the details.

Regards,

Muneeb

Hi Muneeb,

I have created one custom table and create the service for the same.

I want to call the pay statement generation class in that AxdClass prepareForSaveExtended method.

Bt it gives me an error.

Regards,

Janak

Your question is not about a table method, so you’re off-topic here. Please create a new thread and properly describe your problem there. And if you believe that we can read your mind and know what “an error” exactly means, you’ll be disappointed. Giving us all details you have would be a wiser approach.