web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

How do I rename the OOB "Deactivate" button on the subgrid?

(0) ShareShare
ReportReport
Posted on by 65

Hi, 

I loaded the entity in the Ribbon Workbench and used customize button option to rename the button. 

However, there are multiple subgrids in the form. I want to rename the "Deactivate" to "Remove" for only one of the subgrids in the form. How can I achieve this for only one subgrid in the form where there are multiple subgrids in the same form and/or tab? 

Thank you. 

I have the same question (0)
  • Suggested answer
    Dynamics Group Profile Picture
    790 on at

    In Microsoft Dynamics 365 CRM, the "Deactivate" button on a subgrid is a system-generated button that cannot be directly renamed or modified. However, there are a couple of approaches you can take to achieve a similar outcome:

    Hide the "Deactivate" button and create a custom button:

    Hide the default "Deactivate" button by customizing the form and removing it from the subgrid's command bar.

    Create a new button using the form editor and add it to the subgrid's command bar.

    Customize the button's label, icon, and behavior according to your requirements.

    Use JavaScript to dynamically rename the button:

    Add a JavaScript web resource to the form where the subgrid is located.

    Use JavaScript code to target the subgrid's command bar and find the "Deactivate" button element.

    Modify the button's label or text using JavaScript, effectively renaming it.

    Register the JavaScript function to run on the form's load event or any other appropriate event.

    Here's an example of how you can use JavaScript to rename the "Deactivate" button on a subgrid:

  • Suggested answer
    Dynamics Group Profile Picture
    790 on at

    function renameDeactivateButton() {

     // Get the subgrid's command bar

     var subgrid = document.getElementById("subgrid_element_id").control;

     var commandBar = subgrid.GetCommandBar();

     // Find the "Deactivate" button

     var deactivateButton = commandBar.GetChildElement("Deactivate");

     if (deactivateButton) {

       // Rename the button

       deactivateButton.SetText("Custom Label");

       deactivateButton.SetTooltip("Custom Tooltip");

     }

    }

    // Run the function on form load

    window.onload = function() {

     renameDeactivateButton();

    };

  • Suggested answer
    XM-22040801-0 Profile Picture
    11 on at

    Hi,

    Javascript can't rename a command-bar button, but you can duplicate the Delete button:

    - Hide the Delete button when the name of selected control (sub-grid) is equals to your wanted sub-grid.
    - Hide the Remove button (duplicated from Delete button) when the name of selected control (sub-grid) is not equals to your wanted sub-grid.

    To do this, use Ribbon Workbench to duplicate the Delete button (copy / paste).

    1. Remove button:
      1. Add an Enable rule in the Remove command.
      2. Add a Custom Rule => Call a JS function (see bellow) with the selected control as first parameter.
    2. Delete button:
      1. Add an Enable Rule in the Delete command
      2. Add a Custom Rule like the Remove button BUT switch InvertResult to True.

    JS function:

    function isEnabled(selectedControl) {
        return selectedControl.getName() === "";
    }

    Replace the sub-grid name.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 70 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 33 Most Valuable Professional

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans