Skip to main content

Notifications

Announcements

No record found.

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. 
  • Dengliang Li Profile Picture
    Dengliang Li Microsoft Employee on at
    Fetch contacts from multiple segments with condition
    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?
     
  • Suggested answer
    Dengliang Li Profile Picture
    Dengliang Li Microsoft Employee on at
    Fetch contacts from multiple segments with condition
    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
     

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,791 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,488 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans