Cry about...
Dynamics CRM 2011 How To
How to hide or show a section using JavaScript
Dynamics CRM 2011 forms are organized in tabs. Each tab contains sections which in turn contain fields.
The "Section Properties" dialog (which is accessible inside the form designer of Dynamics CRM 2011) lets you specify whether a section is visible (or hidden) by default.
By adding JavaScript to an event handler you can hide or show a section in code. You need to know the name of the tab the section is on and then to show the section is simply:
Xrm.Page.ui.tabs.get("tab_name").sections.get("section_name").setVisible(true);
or to hide the section:
Xrm.Page.ui.tabs.get("tab_name").sections.get("section_name").setVisible(false);
Substituting your own section-name and tab-name in the above.
Be aware that hiding or showing a section does not affect whether the tab itself is visible. So if you want to show a section then you might also want to ensure that the tab is visible:
Xrm.Page.ui.tabs.get("tab_name").setVisible(true);
You can also show and hide sections and fields, see:
These notes have been tested with Microsoft Dynamics CRM 2011, and may apply to other versions as well.
About the author: Brian Cryer is a dedicated software developer and webmaster. For his day job he develops websites and desktop applications as well as providing IT services. He moonlights as a technical author and consultant.