Dynamics 365 – How to Show/Hide Sections and Form tabs

Just like attributes, tabs and sections are also controllers of the forms in Dynamics 365. You can apply same logic to show and hide those controls by using Javascript.

For the tabs; you need to know unique name of the tab you are going to show/hide.
For the sections, you need to know unique name and tab name which that section belongs to.

How to find tab and section names:
From the Form editor you can find section and tab names easily. Just select the Tab and Section components in your classic or modern Form editor.

Code

projectTaskSection: function (executionContext) {
let formContext = executionContext.getFormContext();
//get tab
let tabObj = formContext.ui.tabs.get("tab_name");
//get section
let sectionObj = tabObj.sections.get("section_name");
//show the tab
tabObj.setVisible(true);
//show the section
sectionObj.setVisible(true);
//hide the tab
//hide the section
tabObj.setVisible(false);
sectionObj.setVisible(false);
}

One thought on “Dynamics 365 – How to Show/Hide Sections and Form tabs

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s