web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Fetch XML comparing two entity fields

(0) ShareShare
ReportReport
Posted on by

Hello, 

I am wondering if its possible to construct a fetch xml that will obtain all lead records that have the same district as a logged in user. Users have a district as well as leads having districts and I need a query for all records with same districts. So for example my district can have multiple users, I want to see all leads with my district and if a user from a different district logs in he can see his districts leads. 

*This post is locked for comments

I have the same question (0)
  • ashlega Profile Picture
    34,477 on at
    RE: Fetch XML comparing two entity fields

    Hi,

     When it comes to fetchxml, you can't compare fields to fields. So no, you can't do that. Sure you can search on the current user, but, if I understand the question correctly, it's not what you need.

  • Suggested answer
    Aiden Kaskela Profile Picture
    19,696 on at
    RE: Fetch XML comparing two entity fields

    Hi,

    If I understand, you have a relationship between User and District, and between Lead and District (for example), and you want to build a FetchXML query that shows leads in a district that the current user belongs to?

    If that's the scenario, yes, you can do it in FetchXml or in the advanced find. Do a search for Leads, link to Related - District, link to Related - User, then add the filter User "Equals Current User" (in Fetch, "eq-userid"). Here's a list of all operators, but same vary by version: stoneridgesoftware.com/crm-online-reporting-with-fetchxml-fetchxml-operators

    Hope this helps! I'd appreciate if you'd mark this as Answering your question.

    Thanks,

     Aiden

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#2
ED-30091530-0 Profile Picture

ED-30091530-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans