Sunday, October 10, 2021

Get All Enum Values in d365

 DictEnum dictEnum = new DictEnum(enumNum(SalesStatus));

Counter  c;
;

for (c = 0; c < dictEnum.values(); c++)
{
    info(strFmt('%1: %2', dictEnum.index2Symbol(c),
                          dictEnum.index2Label(c)));
}

This will output the symbol and label of each element in the enum to the infolog.


Ref: - https://www.miklix.com/dynamics-ax/how-to-iterate-over-the-elements-of-an-enum-from-x-code-in-dynamics-ax-2012/

No comments:

Post a Comment