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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Suggested Answer

Advanced find - "not equal" to, to exclude all non-matching records

(0) ShareShare
ReportReport
Posted on by 119

Hi

I am working with Contacts and related Consent records.  There are typically multiple consent records related to Contacts, some of which are Active and others Inactive.

I want to build a view which will show me contacts which have only Inactive Consents, and no Active consents.

Clearly if my view is Contacts where they have related consents where status=Inactive, this will not exclude those where status=Active.

However, If I build a view where the Consent status "does not equal" Active, does that mean it will find Contacts where they have:-

a) at least one Inactive Consent and NO active Consents, or

b) at least one inactive Consent and possibly other consents which are also Active?

Thanks!

I'm happy to work in FetchXML if it's easier!

I have the same question (0)
  • Suggested answer
    Amit Katariya007 Profile Picture
    10,409 Moderator on at

    Hello,

    You can create below views as per the requirement.

    1. Create a view on contact entity and add consent entity columns for the reference. The query will be "select contact(status = "Active" if u need active contact) where (from related part select the relationship with consent) consent status = inactive"

    <fetch mapping='logical'>  

      <entity name='contact'>  

      <condition attribute='statecode' operator='eq' value='1' />  

         <attribute name='name'/>  

         <link-entity name='consent' to='contact field name'>  

            <attribute name='name'/>

            <filter type='and'>  

               <condition attribute='statecode' operator='eq' value='1' />  

             </filter>  

         </link-entity>  

      </entity>  

    </fetch>  

    2. you can directly create a view on the consent entity where you can mention a condition "consent = inactive and related contact = active" (if you need active contact with the inactive consent).

    <fetch mapping='logical'>  

      <entity name='consent'>

      <condition attribute='statecode' operator='eq' value='1' />      

         <attribute name='name'/>  

         <link-entity name='contact' to='consent field name'>  

            <attribute name='name'/>

            <filter type='and'>  

               <condition attribute='statecode' operator='eq' value='1' />  

             </filter>  

         </link-entity>  

      </entity>  

    </fetch>  

    Thank you,

    Amit Katariya

  • simonsnell Profile Picture
    119 on at

    Hi Amit

    Thanks for the swift reply.

    The issue is that Contacts have Active AND inactive Consents attached to their record.

    Thus, the first view will find Contacts with Inactive Consents attached but also those who also have active consents attached.  Similarly with the second.

    I want a way to show contacts who Only have Inactive Consents and No active Consents attached to their record.

    Is there a way to do this?

    Thanks,

  • Suggested answer
    Amit Katariya007 Profile Picture
    10,409 Moderator on at

    Hello,

    Can you share the Fetch XML query which you are trying.

    Thank you,

    Amit Katariya

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
NeerajPawar Profile Picture

NeerajPawar 31

#2
Tom_Gioielli Profile Picture

Tom_Gioielli 23 Super User 2026 Season 1

#3
Encore Business Solutions Profile Picture

Encore Business Sol... 14

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans