My request was that based on a optionset value I had to show only a specific section from a tab and hide the rest. Each optionset value had a specific section and the section label started with this optionset value. So my condition to show the section was - section name starts with "optionset value".
function ShowHideSectionsBySubject() {
var tabName = "tab_Name";
var sectionPicklistValue = Xrm.Page.data.entity.attributes.get("optionset_field").getValue();
var sections = Xrm.Page.ui.tabs.get(tabName).sections.get();
$(sections).each(function (index, section) {
//hide section
section.setVisible(false);
if (sectionPicklistValue != null) {
if (section.getLabel().startsWith(sectionPicklistValue.toString())) {
section.setVisible(true);
}
}
});
}
No comments:
Post a Comment