web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to Create EDT through X++ ? Already seen previous posts

(0) ShareShare
ReportReport
Posted on by

Hi ,

We want to create EDT through code?

I have tried using the codes from the previous posts , but they dont seem to be working ...

Experienced people please help .....

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Alim BEN HELAL Profile Picture
    70 on at

    Hi Yasu,

    you can use the job below to create your EDT through X++  :

    static void Job19(Args _args)

    {

      UtilIdElements uie;

      XInfo XInfo = new XInfo();

      TreeNode TNode;

      TreeNode DNode;

      str      Props =

          "PROPERTIES\n" +

          "  Name                #AXUStr35\n" +

          "  Label               #\n" +

          "  HelpText            #\n" +

          "  FormHelp            #\n" +

          "  ArrayLength         #1\n" +

          "  DisplayLength       #Auto\n" +

          "  ConfigurationKey    #\n" +

          "  ButtonImage         #Arrow\n" +

          "  Extends             #\n" +

          "  DisplayHeight       #Auto\n" +

          "  StringSize          #35\n" +

          "  Adjustment          #Left\n" +

          "  Alignment           #Auto\n" +

          "  ChangeCase          #Auto\n" +

          "ENDPROPERTIES\n";

      select maxof(id) from uie where uie.recordType == UtilElementType::ExtendedType && uie.utilLevel  == XInfo.currentAOLayer();

      uie.id++;

      uie.utilLevel  = XInfo.currentAOLayer( );

      uie.recordType = UtilElementType::ExtendedType;

      uie.name       = "AXUStr35";

      uie.insert();

      DNode = TreeNode::findNode("Data Dictionary\\Extended Data Types");

      DNode.AOTrefresh();

      TNode = TreeNode::findNode("Data Dictionary\\Extended Data Types\\AXUStr35");

      TNode.sysUtilDelete();

      TNode.AOTsetProperties(Props);

      TNode.AOTsave();

      TNode.AOTcompile();

      pause;

    }

    Otherwise, I saw in some blogs they say that AOTCompile causes Axapta crash and than unstable work. AOTSave method virtually doesn’t save anything.

    the solution is : 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.

    Regards,

    Alim BEN HELAL

  • André Arnaud de Calavon Profile Picture
    301,035 Super User 2025 Season 2 on at

    Hi Yasu,

    I do hope the answer from Alim is working for you. Can you please provide some details in future, so we know what posts and coding was not for you and also describe why it was not your solution?

  • yasu Profile Picture
    on at

    NO it doesnt work !!! thats why I asked ..This job is from 2010 ... 7 years old

  • yasu Profile Picture
    on at

    Sorry Andre , my bad .. will be careful about that in future...

    For now the above code by from Alim doesnt work ...It is seven years old .... compilies fine but  results in huge errors after Execution .... SQL issues error... coding seems not appropraite ...

  • Vilmos Kintera Profile Picture
    46,149 on at

    You post is still not helpful, again. Saying that you have errors and SQL issues, but not sharing that information so we could assist? Have you verified if the issue is independent from the job/changes you have done, by doing a Data dictionary synchronization?

  • Suggested answer
    André Arnaud de Calavon Profile Picture
    301,035 Super User 2025 Season 2 on at

    Hi Yasu,

    There is an example how to create extended data types within the DMF wizard. Enumeration fields will be converted to string fields. These new string fields will get a new EDT in the AOT.

    How this is done would be your example. Find the code in class dmfGenerateEntityTable, method modifyFields. In AX2012R3 this coding starts around line 412.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans