Wednesday, May 2, 2012

Dynamics AX 2009: How to retrieve table properties

Here is the sample code to retrieve table properties in Dynamics AX 2009.

static void TableProperties(Args _args)
    Dictionary                      dictionary;
    TableLabel                      tableLabel;
    SysdictTable                    dTable;
    TreeNode                        Tnode;
    //initilize the data dictionary
    dictionary = new Dictionary();
    // Replace _tableId parameter with the actual table id
    dTable = new SysDictTable(_tableId);
    // initilize the tree node to traverse each property of the table
    tNode = dTable.treeNode();
    // Replace "Label" with any property name of the table. In this case I am getting table label and it will return label id
    // Get actual label from label file
    print sysLabel::labelId2String(tNode.AOTgetProperty("Label"));

No comments:

Post a Comment

I will appreciate your comments !