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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested Answer

Filtering Lead View based on related contact segments

(1) ShareShare
ReportReport
Posted on by 21
Hi!
 
We would like to filter a view for the lead entity based on the related contact (parent contact) that is a member of a certain segment. However, the resulting query is always 0. 
Anyone has an idea why that is?
 
 
 
I have the same question (0)
  • Suggested answer
    Leah Ju Profile Picture
    Microsoft Employee on at
    Hi Partner,
    By 'segment' do you mean segment in Marketing?
    If so, you can't filter records you want through 'Segmentid' or 'Segmentmember' lookup fields on the contact entity.
    Segments do not have a many to many relationship with Contacts.
    There is some kind of many to one relationships from Contact to Segment as there is some strange ‘Segment’ lookup field on the contact but that doesn’t many any sense because a Contact can belong to many many segments.
    You can check that both fields are empty, even if you have added the contact to a segment.
     
    That's why your result queries are always 0: to make irrelevant fields conditional.
    I hope you can verify my answer if it helps you! If you have any questions, please feel free to contact me.
    Regards,
    Leah
  • Crownd Profile Picture
    21 on at
    Thanks Leah!
     
     
    The thing is, i would like to create the View for the lead entity in the sales module and this somehow doesn't work.
    If I query with the same filtering scheme on the contact entity, everything seems to work perfectly fine: Contact -> SegmentMember[equals "Value_XX"]
    So i guess this would be the M:M relationship between Contacts and Segments
     
    Now if i just run the same query and add leads that are related to the contacts (like in the screenshot of my original post) it doesn't work anymore.
     
    so i would query Lead -> Parent Contact for lead (Contact) -> SegmentMember[equals "Value_XX"] 
     
  • Suggested answer
    Leah Ju Profile Picture
    Microsoft Employee on at
    Hi Partner,
    You mentioned: everything seems to work perfectly fine: Contact -> SegmentMember[equals "Value_XX"]
    So the SegmentMember lookup field is not null in contact entity?
    If so,  it may be due to a problem with the chosen relationship between the contact and the leader.
    You selected 'Parent Contact for lead (Contact)'  when query records, so you need ensure that the 'Existing contact' field must be filled if you want to some leads will be returned.
    For example:
    I populated segmentmember onto one contact maually:
    And select this contact in the following lead:
    Filter leads:
     
    The following lead can be returned:
  • Crownd Profile Picture
    21 on at
    Thanks again for taking the time and responding!
    However, I am still confused.
     
    So I checked again and the "Leads -> Parent Contact for lead (Contact)" is definetely correct and spills out a result if I query this. 
     
    On the contact entity, if I view the SegmentMember or Segment-ID column, I do not see any values whatsoever. However, what i really do find weird, is that if I filter  Contact -> SegmentMember[equals "Value_XX"] it works just as expected:
     
    So it seems like there is a difference between the normal Contacts and the Parent Contact for lead (Contact)???

     
  • Leah Ju Profile Picture
    Microsoft Employee on at
    Hi Partner,
    As you said: So it seems like there is a difference between the normal Contacts and the Parent Contact for lead (Contact)???
    It's crazy that everything does work out as you say
  • Suggested answer
    Leah Ju Profile Picture
    Microsoft Employee on at
    My test:
    1.In contact, these two queries will return different results:
     (1) contacts who 'segmentmember'' column is this segment will be returned.

     (2) only when the contact has been added as a member of a segment, they will be returned regardless of whether their 'segmentmember' column has a value.

  • Suggested answer
    Leah Ju Profile Picture
    Microsoft Employee on at
    2.In Lead, only one result will be returned through two queries.

    --These leads will only be returned if the 'segmentmember' column of the parent contact is this segment:

    Very strange design, not sure why it is so, but it seems we just have to accept it.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
11manish Profile Picture

11manish 78 Super User 2026 Season 2

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 44 Super User 2026 Season 2

#3
ParthPatel249 Profile Picture

ParthPatel249 40

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans