Ribbon Workbench is an essential tool in Dynamics 365 that allows you to customize command bars (ribbons) intuitively using a drag-and-drop interface. This tool makes it easy to create, modify, and delete buttons and commands in list views, forms, and entity subgrids. Thanks to this it is possible to achieve greater customization.

Posibles Usos

Here are some of the ways you can use custom Ribbon Workbench developments:

Add Custom Buttons: You can add buttons that run specific scripts or perform actions such as opening custom forms.

Modify Existing Buttons: Change the functionality of the default buttons to suit your organization’s needs.

Remove Unnecessary Buttons: Simplify the user interface by removing buttons that are not relevant to users.

 

Beneficios

The most common benefits of using custom ribbons:

• Ease of Use: The drag-and-drop interface makes customization accessible even to users without advanced programming knowledge.

Flexibility: Allows for a wide range of customizations, from simple label changes to complex automated actions.

Efficiency: Speeds up the customization process, reducing the time and effort required to implement changes.

Requeriments

• Install Ribbon Workbench extension in XrmToolbox

 

• Any text editor for code development

 

Optimize your Dynamics 365 Interface with Ribbon Workbench Axazure

Use Case

Next, we will develop an example of a basic concept of how to interact with the ribbon of the entities.

In this development, we will define a custom button in the Account entity, which, using a little JavaScript code, will display the name of the current account displayed in the form in a pop-up message:

Optimize your Dynamics 365 Interface with Ribbon Workbench Axazure

Create the solution

The first thing to keep in mind is that, in order to work on the ribbon of a certain entity, it is necessary to create a solution solely and exclusively (if possible) dedicated to the configuration and manipulation of this entity.

In the example case, we will work with the Account entity, therefore, we will proceed to create a solution from scratch with this entity added to the solution.

Note 1: In the solution, only add the entity you want to work with, without adding any additional components (view, field, form, etc.).

Note 2: This process must be done with the classic solution manager, since, if it is done with the new/current one, when adding the solution to the Ribbon Workbench, it will not be recognized as a valid solution.

Optimize your Dynamics 365 Interface with Ribbon Workbench Axazure

First look at Ribbon Workbench

As soon as you open the Ribbon Workbench, you will see a screen that tells you to load the solution you want to work with. In this case, you will select the one you created previously:

Optimize your Dynamics 365 Interface with Ribbon Workbench Axazure

Once the solution is loaded, the following window will be displayed with four key sections:

1. Destination: Made up of three subsections, which allow us to add customization to three elements of the entity:

1.1 Home: Customizes the main command bar that appears in the list views of the entities.

1.2 Subgrid: Modifies the command bars in the subgrids within the entity forms.

1.3 Form: Adjusts the command bar at the top of the individual entity forms.

2. Toolbox: Section that gives us the possibility of adding different elements to the ribbon (buttons, drop-down menus, groups, etc.).

3. Elements box: This section will show all the customization made to the entity ribbon, and in turn separates them into groups.

4. Elements properties box: In this section, all configurations will be applied to the elements selected in the elements box.

Optimize your Dynamics 365 Interface with Ribbon Workbench Axazure

Development

As in our case, what we want is to add a button in the account form section, we will drag the Button element from the toolbox to the Form section of the Destination:

Optimize your Dynamics 365 Interface with Ribbon Workbench Axazure

When you drop the button on the section, you can see that some properties have appeared to configure the button.

You will proceed to configure the properties to add a meaningful name and a key identifier (Id and Label).

It is also important to add a command because without a command the button will not appear.

To do this, select the + icon in the left section in the Commands section and click on it:

Optimize your Dynamics 365 Interface with Ribbon Workbench Axazure

To sum up, commands are essential for defining the actions that are executed when a user interacts with custom buttons in the Dynamics 365 interface. This step will be discussed in more detail later.

It is also possible to add a custom icon to the button, but in this case, we will skip this step:

Optimize your Dynamics 365 Interface with Ribbon Workbench Axazure

Once this change has been applied, the changes will be published by clicking on the top button of the tool:

Optimize your Dynamics 365 Interface with Ribbon Workbench Axazure

This process will take a few minutes to complete.

Note: Make sure there is no other publishing process running in the background as it may cause publishing error or timeout.

If you reload any record of the Account entity, you will be able to see the new button that has been created at the top right, that means that the creation has been successful:

Optimize your Dynamics 365 Interface with Ribbon Workbench Axazure

Implementation of functionality

Next, we will proceed to give functionality to said button, this will be achieved by creating a simple JavaScript, which will display the name of the current account that we are viewing in the form in a notice on the screen.

The first step will be to create a small function that will collect two basic pieces of data for the operation, the context of the form and the value of the account name field. After this, this collected information will be displayed in a simple alert:

Optimize your Dynamics 365 Interface with Ribbon Workbench Axazure

function showAlertWithAccountName(executionContext) {

var accountName = executionContext.getAttribute(“name”).getValue();

if (accountName)

alert(“El nombre de la cuenta es: ” + accountName);

else

This JS file will be called JS_Account.js.

 

Next, we will proceed to add the JS file to a solution as a new WebResource:

Optimize your Dynamics 365 Interface with Ribbon Workbench Axazure

We will select the JS file that has been developed (we can also paste the code directly into the text editor) and make the adjustments that we think are necessary. In our case, we will leave the automatic settings by default and publish the changes:

Optimize your Dynamics 365 Interface with Ribbon Workbench Axazure

El siguiente paso es configurar el nuevo WebResource al botón en el Ribbon Workbench, para ello volveremos a la sección de comandos del botón que se creó y añadiremos un nuevo Javascript Action:

Optimize your Dynamics 365 Interface with Ribbon Workbench Axazure

Next, you will add the following configuration of the action that the button will perform. To do this, you will need to indicate the following parameters:

  • Library: select the Javascript developed for this implementation (JS_Account)
  • Function Name: select the function implemented in the JS code.

Add parameter:

  • Parameter: select PrimaryControl (this parameter refers to the context of the form)
Optimize your Dynamics 365 Interface with Ribbon Workbench Axazure

Once this configuration is applied, it will be enough to publish the applied changes and the configuration of the button in the Ribbon Workbench will be finished.

Final Test

Finally, you just have to go to the registry where the tests were being carried out and press the Show Name button. If the following message appears on the screen, it means that the procedure has been carried out correctly:

Optimize your Dynamics 365 Interface with Ribbon Workbench Axazure

Note: To see the changes made to the Ribbon Workbench it is necessary to refresh the browser cache (Ctrl + Shift + R or Ctrl + F5)

Conclusion

Using custom code to develop custom functionality gives you flexibility and advanced customization, allowing you to tailor buttons and actions to the client’s needs.

It also gives you more detailed control over the appearance and design of the interface (button panel).

I hope this article on developing custom buttons has served as a small preview of the power of this tool and the unlimited possibilities it offers.

About the Author: Aitor Herráez

Optimize your Dynamics 365 Interface with Ribbon Workbench Axazure

Do you want to share?