Many times we are asked by our customers to disable Bulk Edit to certain users or groups of users/teams within the system. That requirement is pretty straight forward and can easily be understood. The resolution to this of course is also easy, and can easily be accomplished by changed the Bulk Edit privilege for a particular security role. What happens though when the requirement is to disable bulk edit from a user only on a particular entity. This becomes a little more complicated.
To disable bulk edit for a particular security role for all entities, we simply modify the Bulk Edit privilege under Miscellaneous Privilege on the Business Management Team of the security role.
When we want to disable access to Bulk Edit on a particular entity there are a couple of choices.
The first choice is allow the user to access the Bulk Edit form, but when the form is loaded to disable all controls. This can be quite easily accomplished with JavaScript. We would open the form, check for the Form Type, and if the form Type = 6 (BULK_EDIT), we would call a function to loop through the Controls Collection of the Form, and disable all controls. The following code is an example of how to disable or hide all fields when loading the Bulk Edit Form:
function onLoad() { var formType = Xrm.Page.ui.getFormType(); if (formType == FORM_TYPE_BULKEDIT) { disableAllFields(); // or hideAllFields(); } }
The second alternative is to modify the Bulk Edit button, so that it only shows based on a particular security or privilege. We can easily do this using Ribbon Workbench. All that is necessary is to add to the Bulk Edit command Display or Enable rules, so that the button will only show up when the user that is planning to do Bulk Edit has the appropriate privileges. The following screenshots demonstrates this:
All that is necessary is to add either a JavaScript command, Display Rules or Enable Rules to the Command above, so that it filters the access to the Bulk Edit button.
Note that this process will have to be done on every entity individually (either option 1 or option 2) that you would like to customize the Bulk Edit permissions.