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 :
Customer experience | Sales, Customer Insights,...
Answered

Regarding Option Set

(0) ShareShare
ReportReport
Posted on by 104

I want to create new option set values dynamically, Is there any approach for that

I tried to use addOption(obj) method but dynamically created option are only available in UI side and Database couldn't add new created options

I have the same question (0)
  • Verified answer
    meelamri Profile Picture
    13,216 User Group Leader on at

    Hello,

    You can create a single line of text field and implement a PCF control to display the text field as an option Set.

    Another option is to use a webressource for the rendering, and you will store the selected value as a single line of text.

  • vashti hatami Profile Picture
    40 on at

    hi

    you can use this JS code:

    var low = {value : 100000000, text : "Low"};

       var medium = {value : 100000001, text : "Medium"};

       var high = {value : 100000002, text : "High"};

       var pickList = Xrm.Page.getControl("control_name");

       var options = pickList.getOptions();

       for (var i = 0; i < options.length; i++)

           pickList.removeOption(options[i].value);

       pickList.addOption(low);

       pickList.addOption(medium);

       pickList.addOption(high);

  • Pradnya Wankhade Profile Picture
    104 on at

    Hi Thanks for responding on my post , can you please share any example so I can take as reference

  • Pradnya Wankhade Profile Picture
    104 on at

    I have tried same but, see all the added option are available on UI Side only In the database data couldn't added. Because of this getting error while storing the record

  • Suggested answer
    meelamri Profile Picture
    13,216 User Group Leader on at

    You can play with this PCF Control, try it.

    github.com/.../PCF-Controls

  • Pradnya Wankhade Profile Picture
    104 on at

    13457.Capture.PNG

    I got this error when I will choose the newly added option from Option Set

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 > Customer experience | Sales, Customer Insights, CRM

#1
Pallavi Phade Profile Picture

Pallavi Phade 96

#2
Tom_Gioielli Profile Picture

Tom_Gioielli 69 Super User 2025 Season 2

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 43 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans