Skip to main content

Notifications

Customer experience | Sales, Customer Insights,...
Unanswered

Getting Duplicate Pages When Using FetchXML to Search From CRM

Posted on by Microsoft Employee

Hi CRM experts

 

I ran into a problem where we get duplicate records when search from the CRM using FetchXML.

 

We are performing the RetrieveMultiple operation, and making use of the page, count and paging-cookie to achieve pagination. It works fine when the records fit in the first page. But, when the records requires multiple pages, there will always be duplicate records being fetched, and the number of duplicate records is the same as the page size.

 

When I tried to look into the requests we send, looks like the duplication comes from the first page we fetched. Following is an example. There are 282 opportunity records in total for this search request, and I'm setting the page size as 100. I observed the following communication happens:

 

1. Request:

Response:

moreRecords=true,

nextPageCookie='<cookie page="1"><opportunityid last="{02853206-A3A1-E911-A97E-000D3A18CB47}" first="{8E7880AE-419B-EB11-B1AC-000D3A133FF1}" /></cookie>'

[….100 records from 8E7880AE-419B-EB11-B1AC-000D3A133FF1 to 02853206-A3A1-E911-A97E-000D3A18CB47

 

2. Request: 

">

Response:

moreRecords=true,

nextPageCookie='<cookie page="1"><opportunityid last="{02853206-A3A1-E911-A97E-000D3A18CB47}" first="{8E7880AE-419B-EB11-B1AC-000D3A133FF1}" /></cookie>'

[…100 records from 8E7880AE-419B-EB11-B1AC-000D3A133FF1 to 02853206-A3A1-E911-A97E-000D3A18CB47

 

3. Request: 

">

Response:

moreRecords=true,

nextPageCookie='<cookie page="2"><opportunityid last="{8D6F8E5B-D847-EA11-A812-000D3A1BB7BB}" first="{93D50E9D-99A5-E911-A97E-000D3A18CB47}" /></cookie>'

[…100 records from 93D50E9D-99A5-E911-A97E-000D3A18CB47 to 8D6F8E5B-D847-EA11-A812-000D3A1BB7BB

 

 

4. Request:

">

Response:

moreRecords=false,

nextPageCookie='<cookie page="3"><opportunityid last="{7AEA9762-FF89-E811-811E-C4346BAC4304}" first="{D09B2A19-5653-EA11-A812-000D3A1BB7BB}" /></cookie>'

[…82 records from D09B2A19-5653-EA11-A812-000D3A1BB7BB to 7AEA9762-FF89-E811-811E-C4346BAC4304

 

As I observed, the request for page 1 and page 2 are returning the same paging-cookie as well as the same 100 records, and thus causing this issue. To get around this, we have to discard the first page.

 

We are following the example mentioned here: https://docs.microsoft.com/en-us/powerapps/developer/data-platform/org-service/page-large-result-sets-with-fetchxml , but I don't see the behavior above mentioned anywhere. This issue has been observed in our internal Dynamics CRM online sandbox, and we also have some customer complained about it who are using Dynamics CRM on premise.

 

I'm wondering if this is a bug in the CRM fetch XML api, or anything related to the CRM settings.

 

Can anyone suggest, please?

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans