Hi,
I am writing a plugin which creates a team and assigns 2 security roles to the team. Then I want to assign a custom entity record (ExternalEvent record) to the team.
The team is created successfully and the roles are added to the team however the AssignRequest is returning an error:
An error occurred in AssignExternalEvent: Principal team (Id=fd4649b7-25fc-eb11-94ef-0022489c99de, type=9, teamType=0, privilegeCount=0), is missing prvRead####externalevent privilege (Id=f66c6482-ff2f-48ed-97b1-ae27b1a46dc6) on OTC=10831 for entity '#######' (LocalizedName='External Event') in Business Unit (Id=9eeca179-31e2-e911-a84a-000d3ab18578). context.Caller=2af029a0-0e6b-42a6-b8cb-c84539733ed8. Or identityUser.SystemUserId=67ee664f-b847-4c12-b2d3-a70251384660, identityUser.Privileges.Count=7059, identityUser.Roles.Count=0 is missing prvRead####_externalevent privilege (Id=f66c6482-ff2f-48ed-97b1-ae27b1a46dc6) on OTC=10831 for entity '#######t' (LocalizedName='External Event')
If I remove the AssignRequest from the plugin, it works successfully; the team is created with the right roles and I am able to assign the record to the team from the UI.
This is the plugin code:
service.Associate( "team", ownerteamid, new Relationship("teamroles_association"), new EntityReferenceCollection() { new EntityReference("role", roles.Entities[0].Id), new EntityReference("role", roles.Entities[1].Id) }); AssignRequest a = new AssignRequest { Assignee = new EntityReference("team", ownerteamid), Target = new EntityReference(extEvent.LogicalName, extEvent.Id) }; service.Execute(a);