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 :
Dynamics 365 Community / Blogs / Dynamics CE Tech Blog / Hide Formselector on the Fo...

Hide Formselector on the Form – Dynamics 365 CE/CRM

gopi.royal999@gmail.com Profile Picture gopi.royal999@gmail... 430

Hi Everyone,

Today I got a requirement to hide FormSelector on the Form as Users would have access to multiple forms but we have to navigate them to right form based on a field value on the record and we shouldn’t give an option to change the form to the User.

My initial thought was it’s not possible to hide formselector but one of my colleagues came up with the below piece of the code and it worked like a charm.

Logic is simple, set Visibility of the forms to False.

 var formContext = executionContext.getFormContext();
    formContext.ui.formSelector.items.get().forEach(function (item, index) {
        // hide all the form apart from Opportunity.
        if (item.getLabel() != "Opportunity") {
            item.setVisible(false);
        }
    });

Without above code, we see formselector

With code, we don’t see formselector

Hope this helps.


Happy 365’ing
Gopinath

Comments

*This post is locked for comments