I have a question about adding AOT objects by X++ Code on D365 FO. The goal, is to automate creation of security duty, via x++ code, instead of doing it manually
I'm trying actually with the Following code,
public static void main (Args _args)
{
#AOT
str objectName = 'MySpecTable' ;
TreeNode nodePath = TreeNode::findNode(#TablesPath);
TreeNode nodePath1;
nodePath1 = nodePath.AOTfindChild(objectName);
if(nodePath)
{
nodePath.AOTadd(objectName);
//nodePath.AOTsave();
info("Sec privilege well added");
}
else
{
nodePath.AOTadd(objectName);
nodePath.AOTsave();
info("Table well added");
}
}
But i receive the Following error,
is there any way to achieve this goal.to be able adding them via code.
Thanks