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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Fetch contacts from multiple segments with condition

(0) ShareShare
ReportReport
Posted on by 2
 
Hi, 
 
I am trying to use Postman API to fetch contacts that are in segments. 
I want to fetch several segments (with some condition, like segment name contains /xyz/) and their contacts, but I only know how to fetch contacts from one single segment. 
Is there any solution? 
 
POST {{OrgUrl}}/api/data/v9.0/msdyncrm_FetchContactsByQuery{    /Query/:/(SEGMENT(SEGMENT_CRM_ID_e1fa7fdc5c78ea11a811000d3a8e8fcc)).ORDERBY(fullname ASC).SKIP(0).TAKE(15).SELECT(contactid)/,    /FetchXml/://,/OwningBusinessUnit/:/0b4b85cc-7f6c-ea11-a811-000d3a54d359/,    /Scope/:270100000,    /TimeZone/:null}
I try to revise (SEGMENT(SEGMENT_CRM_ID_e1fa7fdc5c78ea11a811000d3a8e8fcc)) to (SEGMENT(IN(SEGMENT_CRM_ID_e1fa7fdc5c78ea11a811000d3a8e8fcc, second_segment_id)), but it doesn't work. 
I have the same question (0)
  • Suggested answer
    Dengliang Li Profile Picture
    Microsoft Employee on at
    Hi,
     
    There is a one-to-many relationship between the segment entity and the contact entity.
     
    Therefore, you can try to query related contacts using the Collection-valued navigation properties.
     
    The following example retrieves the segment name attribute from the first two segment records and expands the information about the associated contacts to include the full name
    GET {{webapiurl}}msdyncrm_segments?$select=msdyncrm_segmentname&$expand=msdyncrm_msdyncrm_segment_contact($select=fullname)&$top=2

    Best Regards,
    Dengliang Li
     
  • Dengliang Li Profile Picture
    Microsoft Employee on at
    Hi,
     
    Has the issue been solved?
    Have there been any updates? Please feel free to ask me if you have any questions!
    If it has been resolved, can you mark the response as an answer?
     

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 70 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 33 Most Valuable Professional

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans