0

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.

Alex Kwitny
  • 11,211
  • 2
  • 49
  • 71
Eternal Learner
  • 121
  • 4
  • 19
  • Do you want to transfer the cancellation to the legacy system right after the "Cancel line" function or after the approval of the cancellation by the workflow? Why do you think an AIF service would be called after approval of the change? – FH-Inway Jun 08 '18 at 16:58
  • @FH-Inway I want to transfer after the approval of the workflow. The issue is that I can’t figure out where the current POs are transferred to legacy, and what methods are called when a line is cancelled. – Eternal Learner Jun 08 '18 at 19:15

2 Answers2

3

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

Alex Kwitny
  • 11,211
  • 2
  • 49
  • 71
0

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.

Carlos Valenzuela
  • 816
  • 1
  • 7
  • 19