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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Answered

Hide multi select option set field

(0) ShareShare
ReportReport
Posted on by 20

Hi
I have a multi select option set field which I want it to hide base on the value of another optionset field. through business rules it seems imposibble because the field doesn’t apear on the entitiy’s fields list.

And also SetVisible function doesn't work on the field.
what should I do?


Regards

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi,

    You can create a on change event to achieve this. I used Account entity to test, if the value of industry field is Accounting, the ownership would be hidden.

    Please follow the step:

    1. Navigate to Data->Tables->Account->Account for Multisession experience, click Add Library button in Form Libraries.

    pastedimage1629708012669v1.png

    2. Click New Web Resource button to create. After Web Resource created, choose that Web Resource to add library.

    pastedimage1629708198276v3.png

    pastedimage1629708281260v4.png

    3. Click industry filed on the form and add on change event. Finally, save and publish form.

    pastedimage1629708572154v5.png

    My sample code of Web Resource:

    function formOnChange(executionContext){
        var formContext = executionContext.getFormContext();
        var industry = formContext.getAttribute("industrycode").getValue();
        if(industry  === 1){
            formContext.getControl("ownershipcode").setVisible(false);
        }else{
            formContext.getControl("ownershipcode").setVisible(true);
        }
    }

    Result:

    When the value of industry isn't Accounting, ownership field is visible

    pastedimage1629708866329v6.png

    Otherwise, ownership field is hidden

    pastedimage1629708939663v7.png

  • ParinazNdlz Profile Picture
    20 on at

    Thanks Steve for the answer.

    My main problem is that the type of the field that I'm trying to hide is Multiselect option set. And setVisible function is not available for this type of field.

    The field also doen't apear neather in the business rule properties nor at workflow conditions.

  • Verified answer
    Community Member Profile Picture
    on at

    Hello,

    Sorry for misunderstanding your question.

    I created two Multiselect option set fields to test and add them to my form.

    Two Multiselect option set fields:

    pastedimage1629966216229v1.png

    pastedimage1629966227096v2.png

     

    My form:

    pastedimage1629966760630v5.png

    When I change the value of myoption field, the anotheroption field will be hidden:

    pastedimage1629966779127v6.png

    Here is my code:

    function formOnChange(executionContext){
    	var formContext = executionContext.getFormContext();
    	var myoption = formContext.getAttribute("cr5a6_myoption").getValue();
    	if(myoption) {
            formContext.getControl("new_anotheroption").setVisible(false);
    	}else{
            formContext.getControl("new_anotheroption").setVisible(true);
        }
    }

    When you use setVisible function for Multiselect option set field, did you get any error message?

  • Community Member Profile Picture
    on at

    Hi,

    Multi-select option sets can't be used with any of the below:

    Workflows, business process flows, actions, dialogs, business rules, charts, rollup fields, or calculated fields.

    For reference refer to MS documentation: docs.microsoft.com/.../types-of-fields

    You'll need to write JS or custom code.

  • ParinazNdlz Profile Picture
    20 on at

    It worked

    Thanks a lot.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
Daniyal Khaleel Profile Picture

Daniyal Khaleel 60 Most Valuable Professional

#2
11manish Profile Picture

11manish 16 Super User 2026 Season 2

#3
Hamza H Profile Picture

Hamza H 8 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans