Quantcast
Channel: CRMHobbit's Dynamics CRM Blog...or "Implement there and back again"» CRM 2011
Viewing all articles
Browse latest Browse all 11

SQL query provides CRM 2011 Security Role privilege options in Excel

$
0
0

Have you ever been in a situation where you need an Excel based method of presenting to a client what out of the box Security Roles and permissions are available within Dynamics CRM?  Luckily, this can be accomplished with a SQL query and some pivot table magic. To provide this information in an Excel format, I used the following SQL query to retrieve this data from a CRM 2011 environment.  The same query will work with CRM 2013 as well:

SELECT DISTINCT FilteredRole.name, EntityView.PhysicalName AS [Entity Name], CASE Privilege.AccessRight WHEN 1 THEN 'READ' WHEN 2 THEN 'WRITE' WHEN 4 THEN 'APPEND' WHEN 16 THEN 'APPENDTO' WHEN 32 THEN 'CREATE' WHEN 65536 THEN 'DELETE' WHEN 262144 THEN 'SHARE' WHEN 524288 THEN 'ASSIGN' END AS [Access Level], CASE PrivilegeDepthMask WHEN 1 THEN 'User' WHEN 2 THEN 'Business Unit' WHEN 4 THEN 'Parent: Child Business Unit' WHEN 8 THEN 'Organisation' END AS [Security Level] FROM RolePrivileges INNER JOIN FilteredRole ON RolePrivileges.RoleId = FilteredRole.roleid INNER JOIN code> PrivilegeObjectTypeCodes ON RolePrivileges.PrivilegeId = PrivilegeObjectTypeCodes.PrivilegeId INNER JOIN Privilege ON RolePrivileges.PrivilegeId = Privilege.PrivilegeId INNER JOIN EntityView ON EntityView.ObjectTypeCode = PrivilegeObjectTypeCodes.ObjectTypeCode ORDER BY FilteredRole.name, [Entity Name]

The resulting Excel spreadsheet, after massaging the data with a pivot table, provides a client ready example of what each OOB security role provides for every permission.  Let me know what you think!  If you have any recommendations or improvements, please share that as well!  Thanks. CRMHobbit (Shawn)



Viewing all articles
Browse latest Browse all 11

Latest Images

Trending Articles





Latest Images