Hide and show entire tabs in Dynamics 365/Power Apps Model Driven Apps based on choice field

I needed to hide and show a tab in a form in my model-driven app, this is the javascript to do it.

JavaScript
function RelationshipTypeChange() {
        if(Xrm.Page.getAttribute("customertypecode").getValue() != "915370002") {
            Xrm.Page.ui.tabs.get("hidden_tab").setVisible(false);
        }
        else {
            Xrm.Page.ui.tabs.get("hidden_tab").setVisible(true);
        }
     }

“customertypecode” is the choice column in the table I wanted to base the conditions on.

“hidden_tab’ is the name (not label) of the tab I was hiding & showing.

There’s also a video (made by someone else) that I found, that is helpful:

Leave a Reply

Your email address will not be published. Required fields are marked *