Knowledge Base - Cloud Connect

Making Custom Buttons

Custom buttons in Microsoft Dynamics 365 CE allow you to streamline user interactions by triggering specific commands, scripts, or navigation actions tailored to your business processes. This guide walks you through creating a custom button using Ribbon Workbench, applying command logic, and defining visibility rules based on context and security roles. Custom buttons such as Configure, Recalculate, Copy, and View enable users to interact with configurations in different ways, including editing, recalculating, copying, and viewing configurations in read-only mode.

By the end of this walkthrough, you'll be able to deploy functional and permission-aware buttons, enhancing the end-user experience across your environment.

The 'Copy / Configure / Recalculate' button is available on Quote, Opportunity, Sales Order, and Invoice forms. This functionality is enabled only if the user has permission to create entities in Microsoft Dynamics 365 CE and one of the following roles:

  • Experlogix CPQ User

  • Experlogix CPQ Copy User / Experlogix CPQ Configure User / Experlogix CPQ Recalculate User (According to the button visibility)

  • Experlogix CPQ Modeler

Teh user permissions for Experlogix CPQ Copy / Configure/ Recalculate User role, is same to that of Experlogix CPQ User role, with the exception of 'Copy' button visibility.

Prerequisites

  • Experience with low code programming in Dynamics CRM/Microsoft Dynamics 365 CE/Power Platform.

  • Familiarity with Ribbon Workbench for Dynamics CRM/Microsoft Dynamics 365 CE & Power Platform.

Button Types Overview

Button

Purpose

Configure

Opens the CPQ Configurator in edit mode

Recalculate

Recalculates an existing configuration using CPQ logic and saves the result

Copy

Creates a new configuration by copying an existing one

View

Opens the CPQ Configurator in read-only mode

All buttons follow the same base creation process, with specific differences in command configuration and enable rules.

Add the Button Using Ribbon Workbench

This section guides you through setting up your solution and opening it in Ribbon Workbench so you can begin customizing the command bar.

Create the New Solution

Start by creating a new unmanaged solution and adding the target entity. Then, open the solution in Ribbon Workbench to begin modifying the UI.

  1. Create a new solution.

  2. Use Add Existing to include the relevant entity (exclude metadata and relationships).

  3. Save the newly-created solution.

  4. Open Ribbon Workbench and connect to the appropriate Microsoft Dynamics 365 CE environment.

  5. Open the newly created solution in Ribbon Workbench.

  6. Navigate to the Main tab and drag and drop a new button for the selected entity.

    SalesOrderEntity in Ribbon ToolBench.png
  7. Set the button's properties using the following table.

    RibbonToolBench Properties Control.png

Button Properties (Common for All Buttons)

For each custom button, configure the following properties. The examples show typical values for Configure, Copy, Recalculate, and View buttons.

Property

Description

Example (Configure / Copy / Recalculate / View)

Id

Unique logical name for the button. Use a clear and descriptive naming pattern.

xpl.Form.salesorder.MainTab.Configure
xpl.Form.quote.MainTab.Copy
xpl.Form.quote.MainTab.Recalculate
xpl.Form.salesorder.MainTab.View

Label

Text displayed on the command bar button.

Configure / Copy / Recalculate / View

Alt

Alternative text used by accessibility tools. Typically matches the label.

Configure / Copy Quote Configuration / Recalculate / View

Tool Tip Title

Short title shown when the user hovers over the button.

Configure
Copy Quote Configuration
Recalculate
View

Tool Tip Description

Brief description explaining the button action.

Configure this entity record
Copy Quote Configuration
Recalculate configuration using CPQ logic
View this entity record

Image 16

16×16 icon displayed on the command bar.

$webresource:xpl_experlogix_logo_16

Image 32

32×32 icon used in expanded views.

$webresource:xpl_experlogix_logo_32

Modern Image

Icon used in the modern command bar experience.

$webresource:xpl_experlogix_logo_svg

Command

Logical name of the command executed when the button is clicked.

Leave empty while creating the button

Command Core

Core command reference. Typically matches the Command value.

Leave empty while creating the button

The Command and Command Core fields are populated after the command is created and assigned to the button.

Do not enter any value for the fields Command and CommandCore because these fields are intended to be populated later when you define the button’s specific actions and behaviors.

Create and Assign the Command

A command defines what happens when your button is clicked. In the steps below, you’ll create a command, assign a JavaScript action, and connect it to the button for execution.

The setup for the Copy and Configure buttons is described in the sections below. This configuration applies to all button types. Any deviations or additional settings required for a specific button (such as Recalculate or View) are called out separately in the Button Differences table.

  1. Go to the Commands section for the entity for which you wish to define the button command.

  2. Select + to add a new command.

In the Properties panel, you'll see that it has been given an ID that uses the solution prefix in the format: {prefix}.{entity_name}.Command1.Command. You can use any suitable sequence of logical names.

Using Custom Buttons4.png
  1. In the Properties: Command Actions, select + Add Action.

    Using Custom Buttons5.png
  2. In the Actions tab:

    1. Select JavaScript Action.

    2. Assign your library and function name.

    3. Add a CrmParameter with value the PrimaryControl.

      Using Custom Buttons6.png
    4. Add a Boolean parameter set to False. For Copy button, only CRM Parameter should be added.

      Add Boolean Parameter set to False.png
  3. Return to the Buttons tab:

    1. Assign the new command to the Command property

    2. Use the same value for Command Core

Define the Enable Rule

The setup for the Configure buttons is described in the sections below.

Use an Enable Rule to control when the button displays based on context or user permissions. This ensures the button only shows when relevant.

  1. In Ribbon Workbench, in the Solution Elements panel, expand the ENABLE RULES section.

    Ribbon Tool Bench Enable New Rule.png
  2. Select the + icon to create a new rule.

    In the Properties panel, you'll see that the rule has been automatically assigned an ID in the format: {prefix}.{entity_name}.EnableRule1.EnableRule

  3. Select Add Step and choose Custom Rule.

    Ribbon Tool Bench Add Custom Rule.png
  4. In the CustomRule panel, complete the following:

    1. Default: False

    2. InvertResult: False

    3. FunctionName: XplRibbon.enableConfigure

    4. Library: $webresource:xpl_Configurator.js

  5. Add the following parameters:

    1. Crm Parameter

      1. Type: CrmParameter

      2. Value: PrimaryControl

    2. String Parameter

      1. Type: StringParameter

      2. Value: (Leave this blank for now)

  6. Save the Enable Rule.

Attach the Enable Rule to the Command

After defining your Enable Rule, you’ll apply it to your command so the button respects your defined logic for visibility and access.

  1. Navigate to the COMMANDS section and select the command linked to your custom button.

  2. In the Actions section, confirm that your JavaScript function is listed.

  3. Scroll down to the Enable Rules section.

    RibbonToolBench Properties Control Enable Rule.png
  4. Select + Add Enable Rule and select your created rule (e.g. xpl.salesorder.EnableConfigure).

  5. At the top of the Ribbon Workbench dialog, select the Publish button to apply all changes.

  6. Once publishing is complete, navigate to your Microsoft Dynamics 365 CE environment and verify that the custom button displays on the entity’s command bar.

Apply Security Roles (Optional)

You can restrict visibility using security roles in the Enable Rule's StringParameter to control which users can see the Configure button.

Enter the applicable security roles in the String Parameter field in the Enable Rule, separated by semicolons.

Example Rule String Parameter

Company User Role 1; Company User Role 2

Each role entered must match an existing security role name in your Microsoft Dynamics 365 CE environment.

Ribbon Tool Bench Set String Parameter for visibility.png

The String Parameter in the Enable Rule controls the button's role-based visibility. If this field is left empty, the Configure button will be visible to all users with access to the entity. Populate this field only if you intend to restrict the button by a security role.

Button Differences

Button

Function Name

Parameters

Enable Rule Difference

Configure

XplRibbon.configure

PrimaryControl

Standard CPQ roles

Recalculate

XplRibbon.recalculateConfiguration

PrimaryControl only

Same as Configure

Copy

XplRibbon.copyConfiguration

PrimaryControl only

Same as Configure

View

XplRibbon.configure

PrimaryControl + Boolean = True

CPQ View User

Creating a View Button for the Configurator in Read-Only Mode

This section explains creating a View button for the Configurator in read-only mode. This button allows users to view configurations without making changes. By performing these steps, you ensure that users can review configurations while maintaining data integrity and preventing unauthorized modifications.

Create a New Custom Button

  1. Follow the steps outlined in the Making Custom Buttons to create a new custom button.

  2. Verify that each new button property has a unique and descriptive name to avoid conflicts and ensure clarity in the configuration.

    Create View Button.png

This helps maintain a well-organized and easily understandable setup, especially when multiple buttons are involved.

Property

Description

Id

Default template {publisher prefix}.{entity name}.Button0.Button. Use any suitable sequence of logical names.

Label

A label that will be displayed on the command button.

Alt

Alternative text for the button used for accessibility tools such as screen readers.

Tool Tip Title

The title displays to the user when they hover their mouse over the command.

Tool Tip Description

The description displays for the user below the tooltip title when they hover their mouse over the command.

Image 16

Add icon image with size 16 pixels x 16 pixels.

Image 32

Add icon image with size 32 pixels x 32 pixels.

Modern Image

Select an icon for the command button. You may choose from any system icons or web resource SVG files. You can also upload your web resource. $Web resource:{web_resource_name}

Sequence

Auto Populated, depends on the button's location compared to other buttons within the same command bar.

Template Alias

Auto Populated, depends on the location of the button.

Command / CommandCore

Leave empty if creating a new button. You'll assign these values once you move to the Command interface of Ribbon Workbench.

Set Command Value

Set the Boolean Parameter to True.

view1.png

Enable Rule

Add Experlogix CPQ View User to the String Parameter.

Create View Button2.png

Additional Information

  • This button is intended for use within the Experlogix CPQ Product Line environment.

  • Ensure compatibility with the latest Microsoft Dynamics 365 CE release. See Cloud Connect Compatibility Matrix and CPQ Integration Compatibility Matrix.