Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

Plugin creates team, assigns role and assign record to team returning missing privilege error

(0) ShareShare
ReportReport
Posted on by 193

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);

Any ideas on how to fix this please?
thanks.
  • Suggested answer
    Charan Raju C R Profile Picture
    7 Moderator on at
    RE: Plugin creates team, assigns role and assign record to team returning missing privilege error

    Hi kelly,

    Try changing your plugin Execution Mode from Synchronous to Asynchronous, if it doesn't impact your process.

  • SarahMoustafa Profile Picture
    25 on at
    RE: Plugin creates team, assigns role and assign record to team returning missing privilege error

    Hi,

    Check for which user the plugin's context is running. If not System Administrator, check the user's privilege for ExtEvent entity.

    You can also double check the team's privilege for ExtEvent entity. Just in case the previous point wasn't the root cause.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 181 Super User 2025 Season 1

#2
Siv Sagar Profile Picture

Siv Sagar 149 Super User 2025 Season 1

#3
Vahid Ghafarpour Profile Picture

Vahid Ghafarpour 124 Super User 2025 Season 1

Product updates

Dynamics 365 release plans