Thursday, August 16, 2012

How to get/retreive security roles from database in MSCRM 4.0

SELECT
SU.FullName,
SU.DomainName,
Role.Name,
SUR.RoleId,SUR.SystemUserId
FROM Role 
JOIN SystemUserRoles SUR ON (Role.RoleId = SUR.RoleId)
JOIN SystemUser SU ON (SUR.SystemUserId = SU.SystemUserId)
WHERE
(Role.DeletionStateCode = 0) AND
(SU.IsDisabled = 0) AND
(SU.DeletionStateCode = 0)

No comments:

Post a Comment