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
    tNode.AOTgetProperty("Label");
    // Get actual label from label file
    print sysLabel::labelId2String(tNode.AOTgetProperty("Label"));
    pause;
}

No comments:

Post a Comment

I will appreciate your comments !

Download large bacpac (sandbox database) to DEV environment much faster

As the LCS website gets slower and slower and the database backups get bigger and bigger.  Use AZCopy to download objects out of LCS asset l...