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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Multi-Select Option Set - clearOptions() NOT clearing selected options

(0) ShareShare
ReportReport
Posted on by

I have JavaScript onChange of a field that needs to trigger another field, a multi-select option set, to clear any/all selected options.

I cannot get it to work using: formContext.getControl("multiselectfieldname").clearOptions();

Anyone else experiencing this issue?

Any suggestions / help would help!!

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Alex Fun Wei Jie Profile Picture
    33,628 on at

    Hi,

    you need to use setValue(null) to remove the selected options. Refer below article for more informations.

    www.itaintboring.com/.../dynamics-365-v9-multi-select-option-set

  • Manju Gurjar Profile Picture
    60 on at

    Hi,

    Try using below syntax.

    formContext.getAttribute("new_multiselect").setValue(null);

    }

    Thanks ,

  • Suggested answer
    Arpit Shrivastava Profile Picture
    7,518 User Group Leader on at

    Hi,

    Check this:

    howtomscrm.com/.../dynamics-365-v9-0-set-multi-select-option-set-values-using-jscript.html

    Set value null instead of using method clear().

    formContext.getAttribute("new_multiselect").setValue(null);

    Hope it helps.

    -Arpit

  • Suggested answer
    Nithya Gopinath Profile Picture
    17,078 on at

    Hi,

    You can set the attribute value to null to clear the muti-select options.

    Please try the code below.

    Xrm.Page.getAttribute("multiselectfieldname").setValue(null);

    Hope this helps.

  • Premz Profile Picture
    50 on at

    Works in version 9.1

    //set the mutli select option set to blank.

    formContext.getControl("fieldname").clearOptions();

    Check this out.

    https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/controls/clearoptions

  • erhan.keskin Profile Picture
    2,253 on at

    Hi,

    clearOptions() is a method to clear the options of the OptionSet field on the form, by that you can re-build your options on the form dynamically.

    However, the values selected by users are different. If you need to clear the selected values, all of them, then set the field to Null.

    Regards,

  • Suggested answer
    Premz Profile Picture
    50 on at

    Yes. Agreed. To clear the selected values setting it to null is the right way.

  • necsa Profile Picture
    3,455 on at

    Hi,

    your link is broken not working

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans