Tuesday, August 7, 2007

Delete an application object from X++

Sometimes you can just not access an element in the AOT without AX crashing in the attempt.

The first thing you can try when that happens is simply to stop the AOS, delete the Application Object Index file (axapd.aoi) and re-start the AOS to rebuild the index file.

If that doesn't work, you could try to delete the element from X++. Here's an example for a job to do that:

static void Job1(Args _args)
TreeNode treeNode;
TreeNode treeNodeTable; ;
treeNode = TreeNode::findNode(#TablesPath);
treeNodeTable = treeNode.AOTfindChild('Table1');

A third option would be to export everything from the layer where you have the problem. Remember to export with ID's. Stop the AOS, delete the the Application Object Data file (ax.aod), re-start the AOS and re-import the exported layer. This third option is of course only applicable for layers you have development access to.