AssignUserRoles and RemoveUserRoles message in plugins-Is this something you can really use in Dynamics 365

Over the last few months, I have receiving loads of request to train people who are new to Dynamics and Powerapps and trying to learn and make a footprint. However with my bandwidth, it becomes really hard to keep track and satisfy all those requests. Also I realized there is lot of query on some specific messages in plugins from newcomers on the platform, apart from the regular messages like Create/ Update/ Delete. I have decided to dedicate the next few blogs specifically to those messages.

In this blog I am going to talk about – AssignUserRoles message. If you are a pro, I guess you can close this post here as you might already be knowing it but I don’t mind anyways if you read it all through.

So whenever someone is new to the platform and trying to ramp up on the technical side, plugins are something they will definitely come across. And whenever I train newbies and the moment I introduce them to the plugin registration tool, they start to look into the available messages and come up with the – “AssignUserRoles” message.

image

And if you are not aware, the most obvious guess post seeing this message is – It fires when you assign Security roles to a user. So in all enthusiasm, you register the step and try to see at runtime what is in this message.

Unfortunately you plugin never fire. You assign security role to your users but it does not fire. You try various combinations, still it doesn’t work. You even try to associate security role with user programmatically but alas! it still don’t fire.

If you are thinking you are making a mistake, it’s not. In Dynamics 365 it does not fire. In fact post CRM 4.0 it never fired. And surprisingly this message is still there.

Then what it is?

In CRM 4.0 days (gosh it’s long back), there used to be a special message – AssignUserRolesRoleRequest to assign security role to users. And when you did that, the plugin registered on the message shall fire. You had a corresponding method to remove security roles – RemoveUserRolesRoleRequest

With the advent of CRM 2011, the request was removed and the generic associate message took care of this situation. So if you want to register a plugin when a security role is assigned to user in Dynamics 365, you need to register a plugin on associate message.

So if you new to Dynamics, i suggest you can safely ignore these messages without losing much information.

Debajit Dutta

(Dynamics MVP & MCT)

For consultation/ corporate training visit www.xrmforyou.com or reach out to us at info@xrmforyou.com

Our product offerings:

Role based views for Dynamics 365 (http://www.xrmforyou.com/role-based-views.html)

CRM-Sharepoint Attachment uploader and metadata manager (http://www.xrmforyou.com/sharepoint-integrator.html)

Record Cloner for Dynamics 365 (http://www.xrmforyou.com/record-cloner.html)

Multiselect picklist for Dynamics 365 (http://www.xrmforyou.com/multi-select-picklist.html)