D365FO – AX – Convert a value into an enum type (str2Enum)

This example show how to convert a value into an enum type.

If value cannot be converted the result of str2Enum is 255

SalesStatus salesStatus;
str salesStatusValue = ‘Open order’;

salesStatus = str2Enum(salesStatus,salesStatusValue); //Put enum type (SalesSatus) and Enum value (salesStatusValue)

Info(enum2Str(salesStatus));

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s