Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

How to add new element to base enums in run time.

Posted on by 157

I had a requirement in which I have to add the enum values to the enum in the run time.

For that I have to add the enum values to the xml.

Can any suggest how to add the enum values to the xml.

  • Neetha Profile Picture
    Neetha 157 on at
    RE: How to add new element to base enums in run time.

    Thank you Nicholas for this work around.

  • Suggested answer
    Sukrut Parab Profile Picture
    Sukrut Parab 71,647 Moderator on at
    RE: How to add new element to base enums in run time.

    Your understanding of how enum works/ enum is wrong. Enum type fields are used when you have a fixed set of values. In your case user is going to enter a value and that value can differ every time they enter, so better you create a set up form as Nikolaos mentioned and use it.

  • Verified answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: How to add new element to base enums in run time.

    That's not possible. Base enums are fixed lists. If you need a dynamic list for selection / lookup, you need to create a table where your user can define these values. Then create table relation to this table, from all tables where you want to use this lookup.

    The standard system is full of examples, you can check them. For example Payment terms, Customer groups.

  • Neetha Profile Picture
    Neetha 157 on at
    RE: How to add new element to base enums in run time.

    If user enters an enum value in one dialog form, that enum value should get added to the base enum.

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: How to add new element to base enums in run time.

    You can't change the AOT objects (code, metadata) in runtime.

    The source code (xml) only exists in a dev system. Then you build a binary (.dll) out of it, and this binary is used in runtime.

    In test/prod systems only the binaries are present. Not source code.

    However you can have lookups in your form, that you construct in runtime. So perhaps that would solve your business requirement.

    What is your business requirement?

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans