Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Retrieve entity and corresponding access in same query

Posted on by Microsoft Employee

I have a solution that synchronizes Dynamics account data and security to an external system. 

This solution is connecting to an Office 365 Dynamics installation.

So far I've manage to get following logic working:

1. Retrieve all accounts with the RetrieveMultiple function

2. Retrieve all users with the RetrieveMultiple function

3. Foreach account

3.1 Foreach user

3.1.1 Retrieve RetrievePrincipalAccessRequest for accuntId and userId, and parse access to external format 

This works, however the solution is very slow and requires three (atleast) calls to Dynamics.

My question is: Is it possible to write a single RetrieveMultiple QueryExpression (or other) which will contain all account with all users and corresponding accessrights (create,read,assign etc)?

Best Regards,

Marius

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Retrieve entity and corresponding access in same query

    Hi Alex,

    Thank you for your reply.

    I've already created plugins for setting access when sharing or assigning a single account.

    I'll see if am able to create a new plugin to look at only the changes like you suggest.

    Best regards

    Marius

  • Verified answer
    ashlega Profile Picture
    ashlega 34,475 on at
    RE: Retrieve entity and corresponding access in same query

    Hi Marius,

      you won't be able to make everything in one call - RetrievePrincipalAccessRequest is doing the calculations for you which you likely can't even do using fetchXml (it has to look at the team roles, use roles, access teams, record sharing..)

      You might try to (possibly) optimize your code in a couple of ways:

    a) Create a plugin to track changes in the security model (role updates, team assignments, role assignments, sharing). For each synchronization run, look at those changes only

    b) If you are on-prem, you might try to use a SQL query that would run directly into the database (although, you'll have to figure out the query)

      

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans