Show or hide form elements

This topic applies to Dynamics 365 Customer Engagement (on-premises). For the Power Apps version of this topic, see: Show or hide model-driven app form elements

Several types of form elements have the option to be shown or hidden by default. Tabs, sections, fields, iFrames, and web resources all provide this option. Using form scripts or business rules the visibility of these elements can be controlled to create a dynamic form to provide a user interface that adapts to conditions in the form.

Note

Hiding form elements is not a recommended way to enforce security. There are several ways people can view all the elements and data in the form when elements are hidden.

Rather than designing forms that depend on scripts to control visibility of options, consider whether a business process flow, a dialog, or switching to a different form may be better suited to meet your requirements. If you do use scripts, make sure that any element that might be hidden is hidden by default. Only show it with scripts when your logic calls for it. This way it will not be displayed in presentations that do not support scripts.

See also

Create business rules and recommendations to apply logic in a form
formContext.ui.tabs (Client API reference)
formContext.ui.sections (Client API reference)
setVisible (Client API reference)