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 :
Customer experience | Sales, Customer Insights,...
Suggested Answer

The recommended way of retrieving segment members - with both a query and a fetchxml - which does what?

(0) ShareShare
ReportReport
Posted on by 2

Hi fellow community,

I wonder if any of you can shed som light on this. Accordgin to Basic operations on segments using API (Dynamics 365 Marketing Developer Guide) | Microsoft Docs this is the recommended way of retrieveing segment members:

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'm having a hard time understanding why there is both a query and a FetchXML. It's seems like there's no limit to the number of result record from the query, while the fetch do have limitations. I tried the following:

Query:

(SEGMENT
	(SEGMENT_CRM_ID
	)
).ORDERBY(mobilephone ASC).SKIP(5000).TAKE(1000).SELECT(contactid)

FetchXML:




My idea is that the query will fetch records from 5001 and to 6000, while the only thing the fetch does is to retrieve only the mobilephone attribute. Is this correct? If I then call this with a query saying SKIP(6000).TAKE(1000) - will it retrieve the next 1000?

I have the same question (0)
  • Suggested answer
    Nya Profile Picture
    29,064 on at

    Hi,

    The maximum number of the contacts which are retrieved with a query is 5000.

    And yes, your idea is correct.

  • Olasan Profile Picture
    2 on at

    For the record - got this from support:

    Regarding your request of query and fetchxml part in retrieving segment members,

    - query is used to specify what contacts to be retrieved

    - And fetchxml is used to specify what fields for each contact you want to retrieve.

    Query is for contacts retrieval and fetchxml is for fields retrieval of a contact.

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 June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Manoj - ManoVerse Profile Picture

Manoj - ManoVerse 131 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 95

#3
Chris1968 Profile Picture

Chris1968 20

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans