Sunday, 1 April 2018

Override form data source field methods in AX7 / D365

In Ax2012 we have commonly customize datasource field methods like jumpRef() or modified(). In AX7 / D365 on extended forms we cannot override datasource field methods. Recommended approach in AX7 / D365 is to avoid overlaying and use extensions as much as possible so for achieving it follow below given steps. In this example I am overriding jumpRef() method on field.

Step: 1
Initialize event handler of the datasource in which you want to override datasource field method. In my case I am using PurchLine_OnInitialized event handler as shown in image.










Step: 2
Then create a method in which you want to give your implementation details and subscribe it to OnInitialized event.















Using this approach we can override any data source field method.

Note: (Custom objects used in this example)

1- EgxPackingInstructionEventHandler (Event handler class)
2- EgxPackingCode_OnJumpRef (Method that provide the jumpRef Implementation)
3- EgxPackingInstructionMenu (Custom form display menu item)

Reference: AX 7. How to override form data source field methods without overlaying.

No comments:

Post a Comment

How to Get Customer Free Text Invoice "Totals" form field value with X++ in D365FO

Customer free text invoices are an essential aspect of financial management in D365FO. In this blog, I have compiled all the code needed to ...