Skip to main content

Notifications

Announcements

No record found.

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 Microsoft Employee

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
    Community Member Microsoft Employee 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
    Dynamics365 Rocker 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
    Community Member Microsoft Employee 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
    Bhavika A. Vala 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 Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,489 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans