Define ribbon display rules
When configuring ribbon elements, you can define specific rules to control when the ribbon elements will display.
Use the /
<DisplayRule>element to define rules controlling when the ribbon element should be displayed.
Use the /CommandDefinitions/
<DisplayRule>element to associate specific display rules to a command definition.
Unsure about entity vs. table? See Developers: Understand terminology in Microsoft Dataverse.
Control when ribbon elements are displayed
By defining display rules in rule definitions, you can use the same display rule for many command definitions. When more than one display rule is defined for a command definition, all of the display rules must evaluate as true for the ribbon element to be displayed.
All display rules provide an optional parameter to specify whether the default value of the rule is true or false and an optional
InvertResult parameter to enable returning a negative result when the item being tested returns true.
/RuleDefinitions/DisplayRules/DisplayRule element supports the following types of rules:
Specifies a rule that detects the type of presentation being used.
Type values correspond to the following:
||The command bar is presented using Dynamics 365 for tablets.|
||The command bar is presented using the updated user interface.|
||The ribbon is presented in forms for tables that were not updated or in a list view in Dynamics 365 for Outlook.|
Allows definition of rules depending on the type of client used.
Type options are as follows:
Use this criteria to display a ribbon element based on whether Dynamics 365 for Microsoft Office Outlook with Offline Access is currently offline.
Use this rule if you want to display a button for the specific type of Dynamics 365 for Outlook.
Typeoptions are as follows:
Detects the version of Microsoft Dynamics 365 for Microsoft Office Outlook.
Use this kind of rule to display ribbon elements when a user has specific privileges for a table. You must specify the privilege depth and the specific privilege you want to check.
Allows definition of rules depending on the Boolean values of specific table properties.
PropertyNameoptions are as follows:
This rule allow for evaluation of the current table. This is useful when you define custom actions that apply to the table template instead of for specific tables. For example, you may want to add a ribbon element to all tables except for some specific tables. It is easier to define the custom action for the table template that applies to all tables and then use an
EntityRuleto filter out those that should be excluded.
EntityRulealso includes an optional context parameter to specify whether the table is being displayed in the form or a list (HomePageGrid). The optional
AppliesToparameter can be set to
SelectedEntityto distinguish whether the table is being displayed in a subgrid.
Specifies a rule that can detect whether a form ribbon is displayed in the context of a specific entity.
Use the form state rule to determine the current type of form that is displaying a record.
Stateoptions are as follows:
Specifies a rule that detects the type of Microsoft Dynamics 365 form.
Typevalues correspond to the following:
||A form displayed in the application.|
||The table preview form displayed as an expanding element in the grid.|
||Used with the appointment, equipment, serviceappointment, and systemuser tables for the Service Scheduling user interface.|
||The form defines a dashboard.|
||A quick view form.|
||A quick create form.|
Specifies a rule that will return false when the web application is viewed in a mobile browser on a tablet device.
Use this kind of rule to check for privileges that do not apply to a specific table, such as ExportToExcel, MailMerge, or GoOffline.
Use this to display a ribbon element if specific organization settings are enabled. Setting options are as follows:
<OrRule>This rule lets you override the default AND comparison for multiple display rule types. Use the
OrRuleelement to define several possible valid combinations to check.
Use this to display a ribbon element if the ribbon is being displayed in Outlook in a specific way.
Typeoptions are as follows:
Use this to display a ribbon element for a specific version of Outlook.
Versionoptions are as follows:
This type of rule checks the URL of the page being displayed. It returns true if the address matches.
<RelationshipTypeRule>This type of rule is applied to records selected in a grid. It lets you determine the type of relationship, as follows:
Use this kind of rule to display a ribbon element for a specific SKU version of Microsoft Dataverse, as follows:
Use this rule to check the value of a specific column in the record being displayed in the form.
For commands defined for subgrid for forms using the updated user experience, value rules cannot be used within display rules. Use this element within an
<EnableRule> to hide an element.