I am sure all fellow developers have faced the frustrating problem of not being able to insert certain objects when importing an XPO or comparing different models, layers. Today I will show you how can you insert the Table Delete actions in code compare window for AX 2012 R3.
Modify \Classes\SysTreeNode\mergeInsertSubnode method in the AOT as per below:
public void mergeInsertSubnode( SysComparable _topComparable, SysCompareContextProvider _context, SysComparable _nodeToInsert) { TreeNode previousSourceNode, previousNode; TreeNode sourceNode; boolean result; TreeNode parentNodeInAot; SysTreeNode nodeToInsert; TreeNode tnDeleteAction; #Properties ; nodeToInsert = _nodeToInsert as SysTreeNode; if (_nodeToInsert && treeNode && TreeNode::isNodeReferenceValid(treeNode)) { parentNodeInAot = TreeNode::findNode(SysTreeNode::getPath(treeNode)); if (parentNodeInAot) { sourceNode = nodeToInsert.parmTreeNode(); previousSourceNode = sourceNode.AOTprevious(); while (!previousNode && previousSourceNode) { previousNode = parentNodeInAot.AOTfindChild(previousSourceNode.treeNodeName()); previousSourceNode = previousSourceNode.AOTprevious(); } // We get here e.g. if treeNode is the form design node. If previousNode=Null node is inserted last, it should be first. if (!previousNode) { previousNode = parentNodeInAot; } if (strScan(sourceNode.treeNodePath(), 'DeleteActions', 1, strLen(sourceNode.treeNodePath()))) { tnDeleteAction = parentNodeInAot.AOTadd('UNKNOWN'); tnDeleteAction.AOTsetProperty(#PropertyTable, sourceNode.AOTgetProperty(#PropertyTable)); tnDeleteAction.AOTsetProperty(#PropertyDeleteAction, sourceNode.AOTgetProperty(#PropertyDeleteAction)); tnDeleteAction.AOTsetProperty(#PropertyRelation, sourceNode.AOTgetProperty(#PropertyRelation)); tnDeleteAction.AOTsave(); result = true; } else { result = parentNodeInAot.AOTDrop(sourceNode, previousNode); } if (result) { // node was successfully dropped previousSourceNode = null; previousNode = null; sourceNode = null; //Clear cached information comparableTextList = null; treeNode = parentNodeInAot; } } } }
Also you may want to make sure you have a better range of what objects can you insert, by changing \Classes\SysCompare\selectionChanged method, and adding the following to line 161:
} allowInsert = true; this.compare(text1, text2,
You can use similar logic to expand AX’s capabilities where it lacks the tools out of the box (indexes, field groups, etc.) similar to what we have done for the Table Delete actions in code compare window.
[…] post Table Delete actions in code compare window appeared first on DAXRunBase blog by Vilmos […]
Wow I was searching for a way to merge delete actions more comfortably a long time, with this modification it’s getting better!
Thanks for sharing!
You saved us hours during our AX 2012 R2 to R3 upgrade. Thanks for sharing this!