How to create EDT from code

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:

  1. Find any EDT node using AOT methods.
  2. Use SysTreeNode::CopyNode() to copy node to the new EDT node.
  3. Change properties according to the needs for the new node.
  4. Export new node EDT to temporary folder.
  5. Parse exported file and set USERTYPE property the same as NAME property.
  6. Import changed xpo file.