Modify OOB ribbon button for Specific Activity Type Entity

By | February 20, 2017


We recently had a business requirement where we wanted to hide the ‘Mark Complete’ OOB button from the home page of Activity entity. However, we wanted to hide this button for Service Activity entity and not for other activity types like Task, Appointment, Email, etc.

‘Mark Complete’ is a button on the Home Page of Activity entity that allows a user to complete the selected activity. This button is enabled when a user selects any Activity from the grid.

Note: The solution mentioned below will apply only for the view of specific entity i.e. Service Activity, Appointment, Task, etc. The solution is not applicable if the user selects the ‘All Activities’ view.

To hide ‘Mark Complete’ OOB button for Service Activity entity, follow the steps mentioned below;

1. Open Ribbon Workbench and select the solution, which contains the Activity entity.

2. By default, the Command property of the OOB ribbon button is disabled.

3. Therefore, first we need to customize the OOB ribbon button. To do this, right click on the ‘Mark Complete’ OOB ribbon button and select the ‘Customise Command’ option as seen below;

Customize OOB ribbon button
4. Now add ‘Enable Rules’ for ‘Mark Complete’ OOB ribbon button. In the ‘Enable Rules’, click on ‘Add Step’ and add ‘Custom Rule’.

5. Now type the function name and select the JavaScript library. Click on ‘Add Parameter’ and add CRM Parameter ‘SelectedEntityTypeName’ in the ‘Custom Rule’ as shown in the screenshot below;

Customize OOB ribbon button

6. To achieve the business requirement, we developed a JavaScript function mentioned below;

//hideMarkCompleteButton() function is used to show/hide the "Mark Complete" button on activity

function hideMarkCompleteButton(selectedentityName) {
    var functionName = "hideMarkCompleteButton() ";
    try {

        if (selectedentityName == "serviceappointment") {
            return false;
        } else {
            return true;
    } catch (e) {
        alert(functionName + e.message);


7. Add the above created rule into the command of ‘Mark Complete’ ribbon button as shown in the screenshot below;

Customize OOB ribbon button

8. Publish the solution.


Using Enable Rules, it is possible to override the default behaviour and show/hide property of ribbon buttons.

One Pic = 1000 words! Analyze data 90% faster with visualization apps!

Get optimum visualization of Dynamics 365 CRM data with –
Kanban Board – Visualize Dynamics 365 CRM data in Kanban view by categorizing entity records in lanes and rows as per their status, priority, etc.
Map My Relationships – Map My Relationships – Visualize connections and relationships between Dynamics 365 CRM entities or related records in a Mind Map view.

6 thoughts on “Modify OOB ribbon button for Specific Activity Type Entity


    Hi ,
    Thanks for wonderful post. Is it possible to hide / disable the Close Activity Button upon completion of custom activity in timeline control in UCI .


    1. inogic


      We cannot hide the “Close Activity” button in the timeline control in UCI using supported way.

      Hope this helps.


  2. Eatsam

    Is it possible to restrict RE-OPEN won Opportunity button for the specfic security roles?

    1. Inogic

      Yes, it is possible to restrict RE-OPEN Opportunity button based on the security roles. You would need to customize the button and create Enable rule. Then you need to add a JavaScript rule for that Enable rule. In JavaScript, you need to write a logic to retrieve the current user’s security role and return true and false. You can use RibbonWorkbench to customize the OOB button.

      Hope this helps.


  3. Devyani Bhatia

    Need to add customize close button to add on subgrid entity. Whenever I open new form from subgrid I do not see close button or icon. I can see close button in ribbon workbench but it is not visible on form.

    1. Inogic


      ‘Close Activity’ button will only appear on the existing record. When you create a new record, the ‘Close Activity’ button will not appear on the form but once you save the record the button will appear on the form.
      Please refer below screenshots for the same:



      Hope this helps.


Comments are closed.