Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Get ActiveDirectoryGuid from SystemUser via FetchXML

(0) ShareShare
ReportReport
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
    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

Announcing the Engage with the Community forum!

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
Victor Onyebuchi Profile Picture

Victor Onyebuchi 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans