Define ribbon actions

Note

This topic is about classic commands.

There is a new way to define commands. See Modern commanding overview (preview).

Define the actions to be performed by a command bar or ribbon control in a <CommandDefinition> element together with rules that control whether the control is enabled or visible in the ribbon.

A Ribbon control can perform two types actions and may include multiple actions:

  • JavaScript Functions: A <JavaScriptFunction> element references a function defined in a JavaScript web resource.

  • Open a URL: The ribbon opens a URL using the value from an Address attribute in the <Url> element. Additional parameters can pass information about how what querystring parameters are passed and the mode in which the window opens.

    You have several options to pass parameters to a URL using the ribbon. More information: Passing Parameters to a URL using the Ribbon

Passing parameters to ribbon actions

Use the following elements to define data to pass to your custom action:

<BoolParameter>

Specifies a value with a Boolean data type that may be passed as a parameter.

<CrmParameter>
Represents data retrieved from the Microsoft Dynamics 365 application that may be passed as a parameter. More information: Pass data from a page as a parameter to Ribbon Actions

<DecimalParameter>

Specifies a value with a decimal data type that may be passed as a parameter.

<IntParameter>

Specifies a value with an integer data type that may be passed as a parameter.

<StringParameter>

Specifies a value with a string data type that may be passed as a parameter.

When parameters are passed to a <Url> element they are passed as a query string. Therefore, they must include a name value to represent the "key" in the query string key/value pair.

Parameters passed to a <JavaScriptFunction> do not require a name but they must be included in the order expected by the function and be of the correct data type.

See also

Customize commands and the ribbon
Define Ribbon display rules
Pass data from a page as a parameter to Ribbon actions