While customizing a Dynamics CRM 2013 form, you may need to show/hide some fields or sections. Let’s say that in this latest Dynamics CRM version, things are getting easier and we have 2 ways to do so.
First, you may have noticed it, Dynamics CRM 2013 includes a new feature called “Business Rules” (BR) that makes it easier to do some basic operations that we used to implement using code. For example, Business Rules can help you make conditions to show/hide a field (but not an entire section).
To show/hide a section, there are 2 ways:
1-Using BR: Hiding all the fields contained in a section automatically hides the section. This can be used especially when you have few fields in your section.
CAUTION: When a BR is defined, you should create the “else” BR. That means a BR which shows your fields when your condition is verified and a BR which hides them when your condition is not OK.
2-Using Javascript: You can also show/hide a section using this JS code:
Xrm.Page.ui.tabs.get(“tabname”).sections.get(“sectioname”).setVisible(true); //Shows a section
Xrm.Page.ui.tabs.get(“tabname”).sections.get(“sectioname”).setVisible(false); //Hides a section
—
[…] While customizing a Dynamics CRM 2013 form, you may need to show/hide some fields or sections. Let's say that in this latest Dynamics CRM version, things are getting easier and we have 2 ways to do… […]
please check the last line. its wrong.
the correct code is :
Xrm.Page.ui.tabs.get(“tabname”).sections.get(“sectioname”).setVisible(false); //Hides a section.
Hello Bharagav Inampudi,
You are right, I’ve edited the post.
Thank you and welcome again!
Hi can hide or show using Javascript
//Hide
Xrm.Page.ui.tabs.get(“TabName”).sections.get(“SectioName”).setVisible(false);
//Show
Xrm.Page.ui.tabs.get(“TabName”).sections.get(“SectioName”).setVisible(true);