Tuesday, February 7, 2012

get values of base enums using code in x++

Question: How to get  values of base enums using code in x++

static void getEnumValues(Args _args)
    EnumId   enumId   = enumNum(LedgerDimensionType);
    DictEnum dictEnum = new DictEnum(enumId);
    int      count  = dictEnum.values();
    int      counter 

    for(counter = 0; counter < count; counter ++)
        // You can use the number of method exposed by DictEnum class
// dictEnum.name(counter)
// dictEnum.index2Value(counter)
// dictEnum.index2Symbol(counter)             
// dictEnum.index2Label(counter)


  1. Thank You,
    It's very helpful.

    For a suggest, you could replace count with countx

  2. how to get gender literal in excel
    from exporting table records to excel sheet....

  3. This is axapta ERP blog for Technical and functional fields and includes Microsoft Dynamics Axapta tutorials and Dynamics Axapta Coverage. This blog also contains x++ code help for Ax developer and solution of technical and functional daily issues. This blog is specific for Microsoft dynamics programming. Enterprise portal, SharePoint services, business connectors and Enterprise Resource Planning applications and sql database.It will help to get Microsoft Business Solutions.

    axapta ERP blog

  4. Hey! For sure, getting axapta changed my business for good - and it needed a change badly. I had no idea just a regular erp software could actually do so much!

  5. It is six years later, but this post is still helpful! Glad I'm not the only one who needed to iterate through a enum. Thank you!