≡ Menu




Enum value to Table Insertion Dynamics Ax 2012 R3, D365 for operations

Let me share you a small tip, During customization We extend out of box Enum for classification. Later client requirement is extensive usage of new Values for classification. For adding new values in enum results dependency on technical person . So we did customization and provide form and custom table so he can create number of values as he want. But now next challenge was, copy enum values and labels in Custom table, So He can use these value instead create again. I used following code snippet to copy data from Enum and insert into Custom table. Hopes this helps.

 

EnumId   enumId   = enumNum(LedgerPostingType);

DictEnum dictEnum = new DictEnum(enumId);

int      _NoOfValueInEnum = dictEnum.values();

int      counter;

CustomTable  _header;

delete_from _header;

for(counter = 0; counter < _NoOfValueInEnum; counter ++)

{

_header.ReportHeaderCode = dictEnum.index2Label(counter);

_header.Description = dictEnum.index2Label(counter);

_header.SortOrder=0;

_header.EnumValue = dictEnum.index2Value(counter);

_header.insert();

 

}
{ 0 comments… add one }

Leave a Comment