Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Auto. Updating values in OptionSet in Dynamics365

(1) ShareShare
ReportReport
Posted on by 314

Hii All,

Is it possible to set Labels and Values automatically in the Optionset Field through code?  Let me explain with example suppose I have two custom Entity types First is Department, and second is Customer, Now I create some Department records then I have created one department Optionset field in the Customer Entity Type, Now while adding the records in the Customer i am selecting the department values(that i added while creating this field) but my requirements is these values are the records that i previously added in the Department entity? when we create the record it is identify by the name (standard attribute of all entities) most of the time. I want this name should populate as Department Optionset value in the Customer Form?  and every time when I add new record in the Department this optionset in Employee should get Updated. Same requirement could be fulfilled using Lookup but my requirement is Optionset?

*This post is locked for comments

  • David Jennaway Profile Picture
    14,065 on at
    RE: Auto. Updating values in OptionSet in Dynamics365

    It is possible to do this using an UpdateOptionSetRequest or InsertOptionValueRequest. However, there are a couple of things to be aware of:

    1. Once you change the option set, you will need to publish it for the changes to take effect. You can use a PublishXmlRequest for this
    2. These actions are metadata operations, and in the past I've found that these are executed on a different transaction isolation level from normal data operations. This can cause errors if you run the code in a plugin, but you can get around this by having the plugin execute asynchronously

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
Victor Onyebuchi Profile Picture

Victor Onyebuchi 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans