How to retrieve enum Id from table field id in d365 fo using x++ Code

0

How to retrieve enum Id from table field id in d365 fo using x++ Code

In Microsoft  Dynamics 365 Finance and Operations (D365 FO), you can retrieve the Enum ID from a table field ID by using the field.enumId() function. Here's an example of how you can achieve this:

internal final class CodingSpiderCodingExamples

{

public static void main(Args _args)

        {

             SysDictField field = new SysDictField(tableNum(PurchReqTable), fieldNum(PurchReqTable,     Requisitionstatus));

              info(strFmt("Enum Id: %1",field.enumId()));

        } 

}


Output :


In the code snippet above, PurchReqTable is the Table and Requisitionstatus is the enum field. After retrieving the Enum ID, the code uses the `info` statement to display the Enum ID in an info log message. You can modify this part of the code to suit your requirements, such as storing the Enum ID in a variable or using it for further processing.


Make sure to replace `TableName` and `FieldName` with the appropriate names from your D365 FO environment.


Post a Comment

0 Comments
Post a Comment
>
To Top