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

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?

  • Olasan Profile Picture
    2 on at
    RE: The recommended way of retrieving segment members - with both a query and a fetchxml - which does what?

    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.

  • Suggested answer
    Nya Profile Picture
    29,058 on at
    RE: The recommended way of retrieving segment members - with both a query and a fetchxml - which does what?

    Hi,

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

    And yes, your idea is correct.

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,886 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,766 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans