Hi Experts,
I'm working on something that should be relatively simple. I have a tab on my account form that should only be visible if the user has a certain role.
Following this blog (with a tweak due to using old ServerUrl instead of ClientUrl) https://srmscrm.wordpress.com/2012/10/30/showhide-tab-or-section-based-on-login-usersecurity-role/
Here is the problem on unauthorized users the Section is not visible but the Tab is still visible. Am I setting something incorrect?
function ShowHideInsideViewSection() { if (UserHasRole("Spirit CRM - InsideView")) { // Tab Name or Guid of it alert("Yes role Spirit CRM - InsideView"); Xrm.Page.ui.tabs.get("InsideView").setVisible(true); Xrm.Page.ui.tabs.get("InsideView").sections.get("InsideViewSection").setVisible(true); alert("tab Visible is set to " + Xrm.Page.ui.tabs.get("InsideView").getVisible().toString()); } else { alert("No role Spirit CRM - InsideView"); Xrm.Page.ui.tabs.get("InsideView").setVisible(false); Xrm.Page.ui.tabs.get("InsideView").sections.get("InsideViewSection").setVisible(false); alert("tab Visible is set to " + Xrm.Page.ui.tabs.get("InsideView").getVisible().toString()); } }
Best Regards,
Diane