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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Regarding Option Set

(0) ShareShare
ReportReport
Posted on by 104

Hello Everyone,

I am adding new value at option set using addOption() method It is working good But same time after adding new value OnLoad() form

I want to save the record with newly created option set value that time it is showing an error,

PFA screenshot for your reference.

And Please suggest approach to solve this issue.

Currently I am using JavaScript for adding option set values.

03736.Error.PNG

I have the same question (0)
  • MikeC282 Profile Picture
    2,175 on at

    Do you have a sample of your code?

  • Pradnya Wankhade Profile Picture
    104 on at

    function addDate() {
    var data = { value: 100000000, text: "Java" };
    var pickList = Xrm.Page.getControl("fieldName");
    var options = Xrm.Page.getAttribute("fieldName").getOptions();
    pickList.addOption(data);
    }

    see this is my code 

  • Suggested answer
    Guido Preite Profile Picture
    54,086 Moderator on at

    you can't add new option values that are not defined inside the field definition

  • Pradnya Wankhade Profile Picture
    104 on at

    Thanks for responding on my question!

    what is field definition can you explain in brief with example?

  • Suggested answer
    Guido Preite Profile Picture
    54,086 Moderator on at

    open the field inside the solution and you see all the values (for example A,B and C with values 1,2 and 3)

    in your JS you can't add D with value 4 because you don't have D with value 4 inside the field definition.

  • Pradnya Wankhade Profile Picture
    104 on at

    Thanks for replying!

    So, how can I add D with value in Option set if it is not available, Please suggest me example so I can add that data in my option set

  • Suggested answer
    Guido Preite Profile Picture
    54,086 Moderator on at

    edit the field like this screenshot 

    click on the +, enter name and value, save and publish

  • Pradnya Wankhade Profile Picture
    104 on at

    It is showing file not found

  • Guido Preite Profile Picture
    54,086 Moderator on at

    updated my previous post

  • Pradnya Wankhade Profile Picture
    104 on at

    Thanks Guido Preite for responding on my post!

    See the given approach in image is correct.

    But what if I want to add the runtime option in option set.

    What should be the approach for that using JavaScript.

    Please suggest me the approach so I can implement for the same.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 214 Super User 2026 Season 1

#2
CU11031447-0 Profile Picture

CU11031447-0 100

#3
NeerajPawar Profile Picture

NeerajPawar 76

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans