Notifications
Announcements
No record found.
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
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
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?
NO it doesnt work !!! thats why I asked ..This job is from 2010 ... 7 years old
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 ...
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?
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 4 Most Valuable Professional
Priya_K 4
MyDynamicsNAV 2