How Do I Know What AOT Class I Need to Change to Modify the Behavior of Canceling PO Lines

443 views Asked by At

Despite knowing AX enough to get around, it's still thoroughly confusing to me. I have a background in Visual Studio C#, and I could always figure out where a particular segment of code was performing the unexpected behavior, but after a year and a half of AX 2012, it's still a mystery.

There's a legacy system that is not getting POs sent from AX whenever a PO Line is cancelled; my objective is to change AX to guarantee that cancelled lines are sent back to this legacy system.

I need to modify the behavior after PO lines are canceled. I know that users cancel the line by going to Procurement and Sourcing => Common -> Purchase orders => All purchase orders. They Request Change on a PO, then under the Purchase Order Lines section, they navigate to Update Line => Deliver Remainder; doing a Personalize on this form shows that the form is called PurchUpdateRemain, a Foundation form. I hit the Cancel Line button, then confirm the change.

I know that a workflow is triggered on this, and I've completed the whole process of approving the change, but no AIF service is called according to the trace I ran on it, so I'm confused as to what AIF service should handle it.

My question is: How do I find where a file should be sent out in AX? AX does not seem to give any indication as to what logic should be called after a line is cancelled. If I could just see the whole flow of the code like I could in Visual Studio, I could determine where I need to make my change in AX, but I've not yet figured out how I can possibly do that. Any tips? I'm at my wits end here.

2

There are 2 answers

1
Alex Kwitny On

A lot of it is just knowledge gained from experience. Pretty much figuring out where to look. Putting a breakpoint in and tracing the code and stepping into methods is often the best way.

Here's a stack trace that shows where the status is changing so you can figure out where to put your code. I cut off line #'s because my code is customized and they wouldn't line up.

StackTrace

0
Carlos Valenzuela On

Hopefully this won't be too late.

Check the class PurchCancel, in the run method you can see the process of how a purchase order is being cancelled.