Ribbon Workbench in Power Platform – Frequently Asked Interview Questions.

Hello Guys,

In our previous blog, we discussed some useful tips to prepare for interviews on JavaScript. Today, we will look at some important Ribbon Workbench tips and interview questions related to Dynamics 365 CRM.



Do follow us to know more about Dynamics and Power Platform. Also if you like our blog then please comment and share this blog with your friends.

Let's see what questions can be asked by interviewers.


1. How to create a custom command bar button for an entity in Dynamics 365 CRM?

In Dynamics 365 CRM (Model-driven apps), custom buttons are created by customizing the Command Bar. Microsoft recommends using the modern Command Bar with Power Fx, whereas the Ribbon Workbench is a legacy method used in older implementations.


2. What are the basic steps involved in creating a custom button using Ribbon Workbench in Dynamics 365 CRM?

First, install Ribbon Workbench and create a solution that includes the target entity. Then open the solution in Ribbon Workbench, select the entity, add a custom button, configure the command and JavaScript action, and publish the ribbon to apply the changes.

3. How can we show or hide a button in Dynamics 365 CRM?

We can use Display Rule or Enable Rule to hide or show button in D365 CRM.

4. What is the difference between Display Rule and Enable Rule?

Display rule can be used to show or hide button using some basic configuration.

Example: 

Based on some field value we want to show or hide button.(Value Rule can be used)

Based on Form State like Create, Existing, Read Only, Disabled we want to show or hide button.

Enable rule can be used to show or hide button using some logics written in JS.

Example: We want to show button to those users who are having some security roles assigned.

5. How to show or hide button based on Security Roles in D365 CRM?

  • Create a Button

  1. Insert a custom button on the ribbon/command bar.
  2. Set label, tooltip, and icon.

  • Create a Command for the Button

  1. Define a command associated with the button.
  2. Commands control actions and rules for the button.

  • Create an Enabled Rule

  1. Add an Enabled Rule to the command.
  2. Configure the JavaScript function that determines when the button should be enabled or disabled.

    function isUserManager(primaryControl) {
        var roles = Xrm.Utility.getGlobalContext().userSettings.securityRoles;
        return roles.includes("Manager");
    }
  • Attach the Enabled Rule to the Command
  1. Link the Enabled Rule to the command in Ribbon Workbench.
  2. Save and publish the ribbon
6. How can I get the selected rows from a subgrid using JavaScript in Dynamics 365 CRM?
function getSelectedSubgridRows(formContext) {
    var subgridControl = formContext.getControl("subgrid_name"); // Replace with your subgrid name
    if (subgridControl) {
        var selectedRows = subgridControl.getGrid().getSelectedRows();
        if (selectedRows.getLength() > 0) {
            selectedRows.forEach(function (row) {
                var entity = row.getData().getEntity();
                console.log("ID: " + entity.getId() + ", Name: " + entity.getPrimaryAttributeValue());
            });
        } else {
            console.log("No rows selected");
        }
    } else {
        console.log("Subgrid not found");
    }
}

Hope it helps...

Comments

Popular posts from this blog

Creating Custom API in D365.

Read Only Sub Grid & Editable Sub grid in Dynamics 365

Using Polymorphic Lookups in D365.