Set Tab Visibility on Dynamics 365 Form Using Javascript
Controls the visibility of specified tabs on a Dynamics 365 form based on form type. Intended to be used in the form's OnLoad and OnSave event.
// ***************************************************************
// Controls the visibility of specified tabs on a Dynamics 365 form based on form type.
// Intended to be used in the form's OnLoad and OnSave event.
// ***************************************************************
function tabsVisibilityControl(executionContext)
{
var formContext = executionContext.getFormContext();
var tabsToHide = ["tab_1", "tab_7", "tab_6", "Assessment", "tab_classification", "tab_5", "tab_housing", "tab_8", "tab_11"];
// Hide tabs in new mode
if(formContext.ui.getFormType() === 1)
{
tabsToHide.forEach(function(tabName) {
var tab = formContext.ui.tabs.get(tabName);
if(tab) {
tab.setVisible(false);
}
});
}
else
{
// Show tabs in any other mode
tabsToHide.forEach(function(tabName) {
var tab = formContext.ui.tabs.get(tabName);
if(tab) {
tab.setVisible(true);
}
});
}
}
No comments:
Post a Comment