web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Save enum label to a field

(0) ShareShare
ReportReport
Posted on by 901

Hi guys,

What will be the correct way of saving enum label to a field with string type ?

When I have a field, lets say MyProjInvoiceStatus (string) then in my code I want to keep the label, I found out I cannot use function Enum2Str()

I have a code that compare the status and when it meets the condition, I would directly put the enum like for example [mytable].MyProjInvoiceStatus = enum2Str(ProjInvoiceStatus::FullyInvoiced)

That one as mentioned is wrong, so what would be the correct way of doing it ?

Thanks,

.

I have the same question (0)
  • Martin Dráb Profile Picture
    237,882 Most Valuable Professional on at

    Why don't you simply store the enum as en enum?

    Do you want to store the actual text (such as "Invoiced" or a label ID (such as @SYS12345?

    If the text, do you realize that it will stopped being translated to user's (and customers' etc.) language? Are you sure you want it? If so, which language do you want to use?

  • Tony zhong Profile Picture
    901 on at

    Hi Martin,

    Yes, to simplify the table because it is for FACT table, and would like to use English as the international language.

    Thanks.

  • Verified answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    How would it be simpler than actual enum value? To me it sounds like a design decision that will just hurt you in the future.

    Anyway you can use strFmt("%1", myTable.MyEnumField) to get the label in your language.

  • Tony zhong Profile Picture
    901 on at

    Hi Nikolaos,

    It would be simpler in regards of the data will be used for FACT table as it will need to de-normalized. There is no need to be in separate table like a master or lookup table for this statuses. By just exposed the description, we no need to take care what is the meaning of value 1/2/3. Also we do not need the index as we also do not need the order sequence.

    However understand your concern, as and when the value needed, I will just added it as another column. Thanks for the input.

    rgds,

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 584 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 499 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 254 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans