As I was producing the associated documentation for my CRM Migration Assistant application, I decided to explore a comparison between a technique that we had to do the â€œhard wayâ€? in CRM 4.0 and a technique that is built into CRM 2011
The technique in question is retrieving a userâ€™s security roles in order to perform some role-specific actions.
I use this code in many different situations to show and hide CRM form elements for specific people.
CRM 2011 SDK Samples
If you open SDK.ContextSamples.js, youâ€™ll see some of the code Iâ€™ll be using today.
Jimâ€™s CRM 4.0 code uses a SOAP call retrieve the security roles for a user. Lucky for us, this functionality is now built into CRM 2011 in the method:
Which returns an array of strings representing the GUID values of each of the security roles that the user is associated with.
This is really great, but I would like to refer to my security roles by name since itâ€™s easier to remember and understand than a GUID. So, I had to add some extra code to handle that requirement.