Trending: Jawaan


Add Fields to a table, using code.... not the AOT.. In Dynamics AX


static void createFieldFromCode(Args _args)

{

    #AOT

    TreeNode            tableNode;

    AotTableFieldList  myAOTTablefieldList;

    SysDictTable  sysDictTable = new SysDictTable(tablenum(moDocuref));

    ;

   if (! hasSecuritykeyAccess(securitykeynum(SysDevelopment),

AccessType::View))

{

return;

}

    myAOTTablefieldList = new AotTableFieldList();

    tableNode = TreeNode::findNode(#TablesPath+'\\'+sysDictTable.name());

    myAOTTablefieldList =

TreeNode::findNode(#TablesPath+'\\'+sysDictTable.name() + "\\Fields");

    if(!myAOTTablefieldList.AOTfindChild("newField")) // check if the field

alredy exists

    {

        myAOTTablefieldList.addString("newField");

    }

tableNode.AOTsave(); 

}

http://www.dynamic-ax.co.uk/


View the original article here

0 Responses to “Add Fields to a table, using code.... not the AOT.. In Dynamics AX”

About Me