How to: Modify Parameter Values in a Pre-Method Event Handler
Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012
In Microsoft Dynamics AX, you can assign a static method to be an event handler that starts and ends immediately before a specific method on a class ends. This is called a before-method event handler, or a pre-method event handler. In the AOT you assign the event handler as a node under the method node. The CalledWhen property on the event handler node must be set to Pre.
The before-method event handler can modify the parameter values passed by the caller method, before the called method receives them.
For more information, see Event Handler Nodes in the AOT.
The AOT Elements
The following table displays the AOT elements that work together to process the event.
AOT element type |
X++ Code sample |
---|---|
Plain method: as a method on the TestClass class. |
|
Event handler: static method on a class. |
|
Node relationship in the AOT. |
In the following image, notice that the formatWholeName method node has a child node for the TestClass::formatWholeNameEhBefore event handler. AOT nodes for a method and its event handler |
Job: to run the simple method. |
|
See also
How to: Modify the Return Value in an Post-Method Event Handler
Event Handler Nodes in the AOT
Announcements: New book: "Inside Microsoft Dynamics AX 2012 R3" now available. Get your copy at the MS Press Store.