Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Get ActiveDirectoryGuid from SystemUser via FetchXML

Posted on by 355

We have a User Import process that keeps our CRM environment in sync with Active Directory, and being On Prem I can easily compare the Active Directory GUID from AD (via ADSI) back to the Active Directory GUID in CRM (systemuser entity) to verify everything lines up.  How though do I get the Active Directory GUID from FetchXML so I can avoid using a direct SQL call to get this information?  When I use FetchXML Builder in XrmToolBox and add activedirectoryguid I get a notice saying "Retrieve can only return columns that are valid to read".  Why can I not get this information via FetchXML?  And how can I get it from CRM directly without going back to the SQL table?  

The issue comes in when a Domain Name in AD changes.  If I key only on Domain Name then try to add the new Domain Name it fails saying the user already exists since the AD Guid has already been used.  After some hunting to find the original Domain Name I resync the new Domain Name in CRM to update the details, but given I have the AD Guid from both AD and CRM it works great to just sync on this in the process.  If the Domain Name changes it just updates this just as it would update the title or name.  Also note I'm updating CRM via CozyRoc,so though reading the CRM AD GUID is coming from SQL updates are not.

Thank you for any advise or suggestions.  

*This post is locked for comments

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Get ActiveDirectoryGuid from SystemUser via FetchXML

    Hello Samalex,

    Since you are using Dynamics CRM On-premise and you got the error message via FetchXML because would not be possible to get the attribute, i would use a SQL query.

    There is no problem by using a select statement on Dynamics CRM databases, since you can do it when using Reports.

    Cheers!

    Pedro Pisco

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,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans