8 Sept 2014

ENUM through code + AX 2012

HI,

Recently i face scenario like create enum through code.


Scenario like when i click create button what ever i gave value that Create new ENUM should create in AOT.

For That

void clicked()
{
 
TreeNode node;
TreeNode dynamicEnum = TreeNode::findNode("\\Data Dictionary\\Base Enums");
;

    dynamicEnum.AOTdelete();
    node = TreeNode::findNode("\\Data Dictionary\\Base Enums");
    dynamicEnum = node.AOTadd(NewEnum.text());
    dynamicEnum.AOTadd("Submitted");
    dynamicEnum.AOTadd("Canceled");
    dynamicEnum.AOTadd("Completed");
    dynamicEnum.AOTadd("Denied");
    dynamicEnum.AOTadd("ChangeRequested");
    dynamicEnum.AOTadd("Returned");
    dynamicEnum.AOTadd("Approved");
    dynamicEnum.AOTsave();
    dynamicEnum.AOTcompile();
    info("Enum created");

}

4 comments:

Nithya said...

Hi,

A small clarification. When we can directly create the enum in the AOT why to create n no enums through code by clicking a button.

When is it used. What is the scenario. How can tis code be helpful

Thanks for the response :-)

Regards,

Suresh G said...

Yes Nithya,

Scenario means have you work on wizards...check workflow wizards that time we have to write code in wizards that time it is very useful...

Nithya said...

Sooper Cool.. Thanks

Unknown said...

excellent brother

Create number sequence in D365 FO

Create the data type. Add code in the loadModule method of the appropriate NumberSeqModule subclass. Add a method to the module’s paramet...