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 / DynamicsDevPro / {Know-How}MSCRM D365 JS - s...

{Know-How}MSCRM D365 JS - show or hide section using display name or label

ram r Profile Picture ram r

Code Snippet to show or hide a Section using display name

Function to show or hide section


ToggleSection = function (tabName, sectionName, isVisible) {
var tabs = Xrm.Page.ui.tabs.get();
for (var i in tabs) {
var tab = tabs[i];
if (tab.getLabel() === tabName) {
var sections = tab.sections.get();
for (var s in sections) {
var section = sections[s];
if (section.getLabel() === sectionName) {
section.setVisible(isVisible);
}
}
}
}
};

Usage
ToggleSection("AdminTab","SectionName",false); //Hide
ToggleSection("AdminTab","sectionName",true); //Show

Note: The labels are case sensitive

This was originally posted here.

Comments

*This post is locked for comments