Show / Hide Section(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 sections

So again I went back to old and faithful… JScript

So here was my scenario:

I had to show the section only if a certain lookup value was not entered and this was based by a simple picklist Yes / No Two Options field.

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:

function HideShowSection() {
var picklist = Xrm.Page.getAttribute(“new_picklistfield”).getValue()
if (picklist == false)
{
Xrm.Page.ui.tabs.get(“tab”).sections.get(“section”).setVisible(true);
}
else {
Xrm.Page.ui.tabs.get(“tab”).sections.get(“section”).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 “HideShowSection” function to the picklist field so that my show hide happens whenever the user changes the picklist.

Note: You can with this JScript Show / Hide multiple sections at the same time if need be.

Hope this will assist you…

You know you want to comment:

Website Powered by WordPress.com.

Up ↑