Search This Blog

Wednesday, May 8, 2013

Create Delete Actions through code in AX


Hi Folks,



Let us create a delete action in InventTable for a testTable.

SysDictTable table;
Treenode treeNode, datreeNode;
table = new sysdicttable(tablename2id("InventTable"));
treeNode = table.treeNode();
treeNode = treeNode.AOTfindChild("DeleteActions");
DAtreeNode = treeNode.AOTadd('UNKNOWN');
DAtreeNode.AOTsetProperty("Table", "TestTable");
DAtreeNode.AOTsetProperty("DeleteAction","Cascade");
DAtreeNode.AOTsave();
In the above code , we get into the AOT node by
 node and go till the delete actions of the table and then 
create the delete actions for that table.

After executing this code, just open the AOT and click on save icon. 
Now, just close the AX client and re-open it again. 
Now, you can find the delete actions created through code.


Happy Daxing.....!

No comments:

Post a Comment