Quantcast
Channel: Microsoft Dynamics 365 Community
Viewing all articles
Browse latest Browse all 10657

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

$
0
0

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();

 

}

Viewing all articles
Browse latest Browse all 10657

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>