Show and Hide Tab(s)

One of the functions in CRM 2013 is to use Business Rules, but there is a limitation when it comes to setting the visibility and it is only for fields and not tabs.

So again I went back to old and faithful… JScript

So here was my scenario:

I had to show the tabs based on a certain picklist value.

Doesn’t sound too complicated now does it? 🙂

Anyway this is what I did:

1. First I added the Web Resource to CRM, below the code:

JScript to Set the Tab visibility to True

function HideShowTabs() {
var picklist = Xrm.Page.getAttribute(“picklist crm field schema name”).getValue();

if (picklist == 1234) {
Xrm.Page.ui.tabs.get(“tabname”).setVisible(true);

 

JScript to Set the Tab visibility to True

function HideShowTabs() {

var picklist = Xrm.Page.getAttribute(“picklist crm field schema name”).getValue();

if (picklist == 1234) {
Xrm.Page.ui.tabs.get(“tabname”).setVisible(false);

2. The Second step was to add the Web Resource to the Form properties.

3. Then I added the onChange and a onLoad Event Handler “HideShowTab” function to the picklist field so that my show hide happens whenever the user changes the picklist and also when the form loads.

 

Hope this helps 🙂

You know you want to comment:

Website Powered by WordPress.com.

Up ↑