Hiding sections with business rules
Since the 2011 versions of Microsoft Dynamics CRM it has been possible to hide fields, sections and tabs with JavaScript by using the following 3 commands:
Field Xrm.Page.getControl("FieldName").setVisible(false);
Section Xrm.Page.ui.tabs.get("TabName").sections.get("SectionName").setVisible(false);
Tab Xrm.Page.ui.tabs.get("TabName").setVisible(false);
By using business rules, which came in the Microsoft Dynamics 2013 version, we are able to hide fields without creating code.
This is done by going into the form customizer and creating a new Business rule.
This is however quite well known…
What isn’t so known is that you can hide a whole section and its label with business rules as well.
This is done by setting all fields in the second to not visible with business rules.
The mistake that many people make is that they set all fields in a section to not be visible by default and then they use the business roles to show the fields. By doing like this the label will still be visible, but no fields will be visible.
If you instead let all the fields be visible by default, and in the business rule define them to not be visible except in the specific case where you want it to be visible, the label will not show. This is done by using the “does not equal to” or “does not contain data” operator.
This does however not work for the tabs so you still have to use JavaScript for them.
Over and out
/Ted













