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 :
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

I have the same question (0)
  • David Jennaway Profile Picture
    14,065 on at

    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

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 > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans