RE: Javascript example needed - Show Tab when Related Entity contains data
Update. Got this to work:
function ShowHideMasterPOMatchPOTabs(executionContext) {
var formContext = executionContext.getFormContext();
var isRole = false;
Xrm.Utility.getGlobalContext().userSettings.roles.forEach(
role => {
if(
role?.name == "System Administrator" ||
role?.name == "*BF Field Service - Zone Manager" ||
role?.name == "*BF Field Service - Dispatcher"
) {
isRole = true;
}
}
);
formContext.ui.tabs.get("tab_4").setVisible(isRole);
}