Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

Setting Form Tab Visibility based on Role only working on section

$
0
0

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


Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>