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?
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156