Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Query for not related to a record

(0) ShareShare
ReportReport
Posted on by

Hi, I know with CRM 2016 and the advanced find you cannot say show me contacts with no tasks without custom fetch XML.

I am curious though if with fetch XML you could could go a step further.

I would like to be able to say show me all contacts not on a specific static marketing list. If I use not on a marketing list it still returns contacts that are on other marketing lists, I would like to be more specific though.

Thoughts?

*This post is locked for comments

  • Community Member Profile Picture
    on at
    RE: Query for not related to a record

    Thanks for the reply. Sorry, but could you be more descriptive as to what you mean?

  • Suggested answer
    Dynamics365 Rocker Profile Picture
    7,755 on at
    RE: Query for not related to a record

    You have to pass Marketing list A GUID while fetching contacts. So your fetch XML will be:

    Find all contacts that are not part of marketing list A.

  • Community Member Profile Picture
    on at
    RE: Query for not related to a record

    Hi Bhavika and thanks for your response. We are on v8 - so we don't have that functionality. But my question was actually a little deeper.

    Pretend I have a contact, John Smith. John Smith is a member of Marketing List A and Marketing List B. With a query I would like to find John Smith and add him to Marketing List C if he is not a member of Marketing List A.

    The query above will not do as I intend as John Smith is also on Marketing List B. So the query will show John Smith, when I want the query to exclude him as he is on Marketing List A.

    Does that make sense? It may not be possible, but it feels like it should be.

    Thanks,

    Rob

  • Bhavika A. Vala Profile Picture
    70 on at
    RE: Query for not related to a record

    Hello Rob,

    Which CRM version are you using?

    In CRM v9 we can apply condition as below. By this query, you will get all contacts which are not in any marketing list.

    <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
    <entity name="contact">
    <attribute name="fullname" />
    <attribute name="telephone1" />
    <attribute name="contactid" />
    <order attribute="fullname" descending="false" />
    <link-entity name="listmember" from="entityid" to="contactid" intersect="true" link-type="outer">
    <link-entity name="list" from="listid" to="listid" link-type="outer" alias="ae" />
    </link-entity>
    <filter type="and">
    <condition entityname="ae" attribute="listid" operator="null" />
    </filter>
    </entity>
    </fetch>

    FilterContacts.png

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 54

#3
Victor Onyebuchi Profile Picture

Victor Onyebuchi 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans