O'Reilly logo

Mastering Microsoft Dynamics AX 2012 R3 Programming by Mat Fergusson, Simon Buxton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Changing the behavior of a class

If we intend to trigger a piece of logic when a method is executed, we would usually use an event. This is not always possible, for example, when we need to hook into a method during its execution. For this, we will use PurchTableType as an example, where the standard code synchronizes the delivery mode with the tmpPurchTable table, which is within the Transport Management System (TRAX).

This table is created within the insert method, and our example change is that we would reverse the vehicle service order flag if the delivery mode causes the standard code to select a carrier. The call stack for the standard code is as follows:

PurchLine.insert Calls PurchLineType.insert Calls PurchLineType.tmsModifiedDlvMode Calls ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required