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.

Before you move on to the next post, Have a look at Click2Clone – Copy Dynamics CRM/365 Records in 1 Click!

4 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 Post author


      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 Post author

      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.



Leave a Reply to inogic Cancel reply

Your email address will not be published. Required fields are marked *