AX 2012: Override the jumpRef Method to modify “View Details”
To add or modify the “View Details” menu entry, on a right click in the frontend of AX 2012, you can override the so called jumpRef() method.
This can be extremely helpful, if you want to present another form, as the standard defined on table level or if you just want to add the functionality at all.
As an example I will modify the CustAccount on the SalesTable header to show the global address book (DirPartyTable), instead of the CustTable form.
Override jumpRef on form level in AX 2012
First we search the element in the form which we want to modify. In my example it is the CustAccount in the group “Customer” at the header view of the SalesTable form.
Right click on method, select “Override method” and finally hit “jumpRef”.
In the code editor paste the following code:
|public void jumpRef()|
|Args locArgs = new Args();|
|// Find and set buffer|
|locDirPartyTable = DirPartyTable::findRec(CustTable::find(SalesTable.CustAccount).Party);|
|// Set record|
|new MenuFunction(menuitemDisplayStr(DirPartyTableMain), MenuItemType::Display).run(locArgs);|
First we select the record we want to pass to the form we plan to open. For this we select the customer from the SalesTable and from the CustTable we take the party. With this number we will find the DirPartyTable entry, which we pass to an Args object and set it up as a record.
At last we create a MenuFunction and open a display menu item, in my case the DirPartyTableMain.
Override “View details” in action
If you now go back and open a sales order in the frontend, then switch to the header view, you can hit the link in the “Customer” section, behind the “Customer account” label, or, if you are in edit mode, click right and then hit “View details”.
Now the DirPartyTable form should be opened, showing the party behind the selected customer.