Recently I was trying to assign all the available Security Roles in a Business Unit to a particular User using following Code:
private void AssignSecurityRoles(IOrganizationService service, Guid userId) { QueryExpression query = new QueryExpression { EntityName = "role", ColumnSet = new ColumnSet("name") }; EntityCollection roles = service.RetrieveMultiple(query); EntityReferenceCollection entityRefCln = new EntityReferenceCollection(); foreach (Entity entity in roles.Entities) { entityRefCln.Add(entity.ToEntityReference()); } service.Associate("systemuser", userId, new Relationship("systemuserroles_association"), entityRefCln); }
To my suprise, I received following error: “The Support User role cannot be assigned to a User”
After debugging the code, I found that there is one role called “Support User” security role present in the list of retrieved security roles. I never seen this role in the CRM UI so quickly went through the CRM UI app and to my surprise it is not available. However, it is present in the SQL Server… !!! Doesn’t it mean it’s a hidden role???? Not aware of the actual purpose of this role. As per SDK documentation, “A user who is a customer support engineer” is the description for the Security Role.
I added an additional conditional to avoid associating “Support User” security role for the time being. Anyone has an idea about the purpose this Security Role????