Search code examples
axaptax++dynamics-ax-2012-r3

Go to different main table from same field AX 2012


I have a InvoiceAccount field in table. And another field in this table is PackingSlipAXType. If PackingSlipAXType is Sales, InvoiceAccount field value is customer account. If type is PurchReturn, InvoiceAccount field value is vendor account.

When value is customer account, when right click and go to main table i want to go Customer and When value is vendor account, when right click and go to main table i want to go vendor.

How can i do this in same field?


Solution

  • There are two primary ways. One is code and the other is using native MorphX and Conditional Table Relations. Code gives you more flexibility, but conditional table relations are simpler and "just work".

    Conditional Table Relations

    Using conditional table relations. I created a new table and AccountNum would represent a customer or vendor account, and the base enum SalesPurch is used to indicate if it is a Customer Account (Sales) or a Vendor Account (Purch). Similar to your setup.

    enter image description here

    Custom JumpRef & Lookup

    You will likely want both a jumpRef and a lookup to both go to the correct main table and lookup the correct values.. This is code, but you have all the flexibility in the world...but may not need it.