It is impossible to create EDT from X++ using standard AOTAdd. AOTCompile causes Axapta crash and than unstable work. AOTSave method virtually doesn’t save anything.
Solution: Use export/import methods.
Steps:
- Find any EDT node using AOT methods.
- Use SysTreeNode::CopyNode() to copy node to the new EDT node.
- Change properties according to the needs for the new node.
- Export new node EDT to temporary folder.
- Parse exported file and set USERTYPE property the same as NAME property.
- Import changed xpo file.