Wednesday, October 26, 2011

How to Check Whether a User has the User Role

This was a functionality that could be acheived in CRM 4 using javascripts. Jim Wang has written a nice article about this.


However with CRM 2011 there is an inbuilt javascript functionality to retrieve the roles of a user. This however will return the Guid's of the user. 

var currentUserRoles = Xrm.Page.context.getUserRoles();
    for (var i = 0; i < currentUserRoles.length; i++)
    {
     var userRole = currentUserRoles[i];
     }

There is a nice article written by Mitch Milam in the below URL of getting this done with user role names.



Thanks Guys for putting these wonderful articles.

No comments:

Post a Comment

Retrieving Calendar of a Bookable Resource in Dynamics

There are occasions where we need to retrieve working days and working times of a resource in Dynamics grammatically. This is quite possible...