Convert string into ENUM str2enum in x++

This post will explain how you can assign and convert string input either read from excel etc into ENUM type variable.

For this example, we will be going to use PurchReqCreationStatus ENUM. The ENUM has 2 key properties


1.      Name ENUM element name

2.      Label – it is used as a string for ENUM conversion 



         PurchReqCreationStatus PurchReqCreationStatus;

         str PurchReqCreationStatusValue = 'Approved';

         PurchReqCreationStatus = str2Enum(PurchReqCreationStatus,PurchReqCreationStatusValue);

         Info(enum2Str(PurchReqCreationStatus));

         Info(enum2Str(PurchReqCreationStatus::Approved));

Comments

Popular posts from this blog

SSRS Report using Controller , Contract and RDP classes in D365

Exporting data to Excel through X++ code

COC for Form level method

How to pass the parameter from one form to another in Dynamic365

Multi Select Lookup in SSRS Report in D365