Dynamics AX Blog - aot - Posts from 2014
These posts are machine-translated.
Currently, only posts from »2014« are displayed
Add object nodes to a shared project through codeFind below a short example, how to add object nodes to a shared project through code. static void AddNodeToSharedProject(Args _args)
{ projectNode projectNode; TreeNode treeNode; #AOT #AOTExport projectNode = infolog.projectRootNode(); projectNode = projectNode.AOTfindChild(#expProjectShared); projectNode = projectNode.AOTfindChild('MyProject'); // Add objects treenode = TreeNode::findNode(#TablesPath+'\\'+tableid2name(tablenum(CustGroup))); projectNode.addNode(treenode); treenode = TreeNode::findNode(#TablesPath+'\\'+tableid2name(tablenum(VendGroup))); projectNode.addNode(treenode); treenode = TreeNode::findNode(#ClassesPath+'\\'+classStr(PriceDisc)); projectNode.addNode(treenode); } The so modified Project will look like this: |
|
|
|
|
|
|
The following job lists all tables where a particular property - in the example the property ModifiedBy is requested - has a specific value.
In macro #Properties you find another possible properties of AOT objects, so you can use the job also to query other properties.
{
TreeNode treeNodeTables;
TreeNode treeNode;
str prop;
str properties;
#aot
#Properties;
treeNodeTables = TreeNode::findNode(#TablesPath + #AOTRootPath);
treeNodeTables = treeNodeTables.AOTfirstChild();
while(treeNodeTables)
{
properties = treeNodeTables.AOTgetProperties();
prop = Global::findProperty(properties,#PropertyModifiedBy);
if(prop == "yes")
{
info(treeNodeTables.AOTname());
}
treeNodeTables = treeNodeTables.AOTnextSibling();
}
}