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

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Remove a selected option from multi select optionset

(0) ShareShare
ReportReport
Posted on by 87

Hello Experts,

I have a requirement where I need to clear a specific option which is already selected on the record from a multi select optionset using javaScript. Unfortunately I cannot use formContext.getAttribute("new_attribute").setValue(null) because it will clear all the selected values but I need to deselect few options.

Please help me to implement the requirement.

Thanks in advance

I have the same question (0)
  • David Jennaway Profile Picture
    14,065 on at
    RE: Remove a selected option from multi select optionset

    You will need to use getValue to get the current values as an array, remove the specific option from that array, then pass the updated array back via setValue. This link gives some sample code

  • cloflyMao Profile Picture
    25,210 on at
    RE: Remove a selected option from multi select optionset

    Hi Amrita,

    > You can get all option value with:

    formContext.getAttribute("new_attribute").getOptions();
    
    

    > You can get a specific option value with:

    var value = formContext.getAttribute("new_attribute").getOptions()[i].value;

    > You can remove a specific option by:

    formContext.getControl("new_attribute").removeOption(value);

    > You can add it back by:

    formContext.getControl("new_attribute").addOption({
    value:value,
    text:'Text you want'});

    Regards,

    Clofly

  • Verified answer
    Naveen Ganeshe Profile Picture
    3,397 User Group Leader on at
    RE: Remove a selected option from multi select optionset

    Hello Amrita!

    Please follow the below link to implement your requirement:

    https://www.inogic.com/blog/2018/09/multi-select-option-set-field-in-dynamics-365-v9-0/ 

  • ajyendra Profile Picture
    1,738 on at
    RE: Remove a selected option from multi select optionset

    Hi Amrita,

    May this blog help you

    community.dynamics.com/.../multi-select-option-set-field-in-dynamics-365-v9-0

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 159

#2
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 152

#3
Tom_Gioielli Profile Picture

Tom_Gioielli 134 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans