Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

DynamicsCRM365 Optionset error

Posted on by 15

I am trying to add new values to option set.

Currently below is the code which i am using.

InsertOptionValueRequest insertOptionValueRequest =     new InsertOptionValueRequest
                {
                    AttributeLogicalName = "new_country",
                    EntityLogicalName = "contact",
                    Label = new Microsoft.Xrm.Sdk.Label("Test", 1033),
                    Value = 100000001
                    //Value = 2
                };         
 int insertOptionValue = ((InsertOptionValueResponse)_service.Execute(insertOptionValueRequest)).NewOptionValue;
  _service.Execute(new PublishAllXmlRequest());

I am getting an error on insertion stating : "another picklist or status option for this option Set already exists with that value".

Any guess whats wrong here?

*This post is locked for comments

  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: DynamicsCRM365 Optionset error

    Hi,

    As per the error message, you already have an optionset value "100000001". Check the existing optionset values and add which are not added.

    Hope this helps.

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: DynamicsCRM365 Optionset error

    Hi Kirtan,

    Seems the options value you are adding is already exists , try with  different value.

    Try with this  -

                    // Create a request.
                    InsertOptionValueRequest insertOptionValueRequest =
                        new InsertOptionValueRequest
                        {
                            AttributeLogicalName = "new_picklist",
                            EntityLogicalName = "contact",
                            Label = new Label("Test", 1033),
                            Value= 10002
                        };
    
                    // Execute the request.
                    int insertOptionValue = ((InsertOptionValueResponse)_service.Execute(
                        insertOptionValueRequest)).NewOptionValue;
    


  • Suggested answer
    Rawish Kumar Profile Picture
    Rawish Kumar 13,756 on at
    RE: DynamicsCRM365 Optionset error

    Hi Kirtan,

    Just a silly question - did you make sure you dont have any value with 1033 and name as Test?

  • Suggested answer
    Dynamics365 Rocker Profile Picture
    Dynamics365 Rocker 7,755 on at
    RE: DynamicsCRM365 Optionset error

    As per your code I can understand you are creating value.

    You can change  Value = 100000001 to something else and check. Thanks

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,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans