Skip to main content

Posts

Showing posts with the label getting field value on a common

Dynamics AX - Getting the value of a given field regardless of tablebuffer

How to get the value of a given field regardless of which tablebuffer is active. Foreign keys in Dynamics AX are scattered throughout the tables of the system, connecting the modules to each other. For example ItemId fields store the item identification in a lot of tables, for storing information related to the item in question. This example shows how you can write a generic method that gets the value of the field ItemId regardless of which table is active at runtime. The example was originally implemented as a method on a form. The method was able to return the value of the field ItemId regardless of which tablebuffer was active, when the form was called ( element.args().record() ). public ItemId getFormItemId() {     common table; // Generic table buffer     DictTable dt; // Dictionary object for handling table information     // Get the table in question     table = element.args().record();     // Make DictTable object     dt = new DictTable(table.TableId);     return table.(dt.fiel