Skip to main content

Notifications

Customer experience | Sales, Customer Insights,...
Suggested answer

How to insert large number optionset value to Dynamics c#

Posted on by 240

HI,

I have optionset value 690970002 which is not inserted to dynamics its allowing only one number value to insert here's my code 

 Entity payment = new Entity("msdyn_payment");

payment["msdyn_paymenttype"] = new OptionSetValue(690970001);

 Guid paymentids = service.Create(payment);

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: How to insert large number optionset value to Dynamics c#

    Hello,

    I'm not sure what exact issue you experience but I would assume that you want to add an additional option to existing optionset. In this case you can use following code in order to do that - docs.microsoft.com/.../microsoft.xrm.sdk.messages.insertoptionvaluerequest

  • LeoAlt Profile Picture
    LeoAlt 16,329 on at
    RE: How to insert large number optionset value to Dynamics c#

    Hi rocky,

    Could you kindly share more detail about your requirement?

    Do you want to insert some options to an option set field or something else?

    Reagrds,

    Leo

  • madiri Profile Picture
    madiri 240 on at
    RE: How to insert large number optionset value to Dynamics c#

    Its not working i am trying for single optionset

  • LeoAlt Profile Picture
    LeoAlt 16,329 on at
    RE: How to insert large number optionset value to Dynamics c#

    Hi partner,

    Please try the following code.

    OptionSetValueCollection collectionOptionSetValues = new OptionSetValueCollection();
    OptionSetValue optionSet1 = new OptionSetValue((int)690970001);
    OptionSetValue optionSet2 = new OptionSetValue((int)690970002);
    collectionOptionSetValues.Add(optionSet1);
    collectionOptionSetValues.Add(optionSet2);
    entity[“new_multioptionsetfield”] = collectionOptionSetValues;

    Best Regards,

    Leo

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans