Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum

How do we programatically De-select all option of Multiselect Optionset in MSCRM using C#

Posted on by 308

Hi all,

I have a requirement in which i want to De-select all options of Multiselect optionset field in Dynamics CRM form when i click Save. 

So it first check the all matching values in database against the values in Multiselect optionset field. After this it has to Uncheck all options in that field and will check only those option those are in database.

Right now my requirement is I want  all values in the Multiselect optionset to be Un-Checked or De-select when the user clicks Save.

for this i have already written below code and it is showing following error.

Code:  entity["new_multioptionset"] = null;

sqlerror.JPG

Thanks in Advance,
Ishan Sharma

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: How do we programatically De-select all option of Multiselect Optionset in MSCRM using C#

    Hello,

    I experienced similar behavior when I tried to put bull to this field during creation. So here is what you should do to make your code work (pseudocode follows):

    if (this is create event)

    {

    //just ignore population of multioptionset field

    }

    else if (this is update){

    entity["new_multioptionset"] = null;

    }

    Have fun!

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

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

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans