Friday, March 4, 2016

User belongs to Different Business Unit than a Role

Hi,
Today I got a scenario to create a User and assign Security Role to a User.
While associating Role to the Team am getting following error
“User belongs to Different Business Unit than a Role”

Resolution:

After creating user check the Business Unit of the User and Pass the Business Unit to the Query Expression and the Result of Role associate to the User

QueryExpression role = new QueryExpression("role") { ColumnSet = new ColumnSet(true) };
                    role.Criteria.AddCondition(new ConditionExpression("name", ConditionOperator.Equal, "Activity Feeds"));
                    role.Criteria.AddCondition(new ConditionExpression("businessunitid", ConditionOperator.Equal, businessunitid));
                    EntityCollection roleActivity = orgService.RetrieveMultiple(role);


No comments:

Post a Comment

Built a PowerApps control that shows PDF files saved records in MSCRM/Dataverse

Please find my YouTube Video link for Built a PowerApps control that shows PDF files saved records in MSCRM/Dataverse  YouTube Link Git Hub ...