CRM Related SQL Queries 1
SQL Queries Version 1 Get Privilege by Role name select priv.* from Privilege priv join RolePrivileges rolePrivileges on (rolePrivileges.PrivilegeId = priv.PrivilegeId ) join Role role on (rolePrivileges.RoleId = role.RoleId) where role.Name = 'system administrator' Get the Users By RoleName select sysuser.FirstName,sysuser.DomainName,sysuser.AccessMode, sysuser.ActiveDirectoryGuid,sysuser.CALType, sysuser.* from SystemUser sysuser join SystemUserRoles userRoles on (userRoles.SystemUserId = sysuser.SystemUserId ) join Role role on (userRoles.RoleId = role.RoleId ) where role.Name ='system administrator' and sysuser.AccessMode=0 and sysuser.CALType=0 and sysuser.IsDisabled=0 Get All Privilege By Role with formatting SELECT DISTINCT FilteredRole.name, EntityView.PhysicalName AS [Entity Name], EntityView.IsCustomEntity AS [IsCustom], displayname.Label as[Entity Display Name] , CASE Privilege.AccessRight WHEN 1 T...