Using the crossreference system as a learning tool
There can be times when you are unsure of how and why a certain feature works in AX. For example how a certain field is calculated or the effect of defining a particular parameter. For this, it is often useful to go ‘under the hood’ to get a direct view of the logic in place.
In this blog we will see how we can use the AX cross reference system to help us locate the exact places in the code where the feature you are interested in has been coded in. For more on the AX crossreference system and in particular how to set it up, you can consult this site https://msdn.microsoft.com/en-us/library/aa877386.aspx
Example
In this example I am interested in learning how and where the AX error account is used in the system. To find out, I would do the following steps
1. Locate the form where the feature I am interested in is defined. In this case, General Ledger\Setup\Posting\Accounts for automatic transactions
2. Once I have opened my form, I want to know more about the settings of the ‘Error account’
3. The first thing I would do is find out the name of the table and field that is listed in the form here. To do this, the easiest way is to rightlick and select ‘Personalize’
4. Note then how the focus on the left pane is on the field you put your cursor in, in this case ‘Posting type’ and to the right, you can see the table name and associated field
In this case I can see that the posting type field is associated with the table ‘LedgerSystemAccounts’ and the field is ‘Code’
5. I go to the AOT, short cut from the application is pressing Ctrl + D and locate the ‘LedgerSystemAccounts’ table(DataDictionary\Tables) and go to the field ‘Code’
On the ‘Code’ field I rightclick and select ‘Properties’ and take a note of the Enum type of the field as I know the field is an Enum(a drop down list). I note the enum is called ‘LedgerPostingType’
6. I proceed to locate this enum by going to Data Dictionary\Base Enums
I expand the ‘LedgerPostingType’ enum and go to ‘ErrorAccount’ as this is what I am interested in
On the ‘ErrorAccount’ node I righclick and select ‘Add-ins\Cross-reference\Used by
And the cross references form appears
And I can now see the places in the code where it is defined when the system will post to the error account