[Dynamics CRM 2013] 2 ways to hide/show 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 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).

rule

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

Advertisements

3 thoughts on “[Dynamics CRM 2013] 2 ways to hide/show a section

    • 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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s