Modify OOB ribbon button for Specific Activity Type Entity

By | February 20, 2017

Introduction:

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;

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.

Conclusion:

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!

Leave a Reply