10 Aug’17

Dynamics 365, EnterpriseIssue faces in retrieving 5000+ records using Web API


While using Fetchxml queries to retrieve more than 5000 records, first page will give you 5000 records and paging cookie. Paging cookie will help to retrieve additional records. For additional records, we need to set the paging cookie in the fetch tag.

Setting the paging cookie:

When the fetch query is executed it brings the paging- cookie with it in the resultant response. The paging cookie is attached to the next Fetch XML

The paging cookie consists of the first and last record details. Name and the GUID of the records.

When trying to execute fetch XML request. it started throwing “Page Cookie Malformed” exception. This is because there is a special character present in the paging Cookie.

You can see in the above cookie that Name has “&” which is the replacement for character “&”. This breaks the fetchXml request.There can be any character present in the record name such as (‘s). Even (‘) breaks the fetch XML.

Thus, we need to encode the paging-cookie before it is inserted in fetchXml.

pageCokies.replace(/&/g, '&');

This will help to solve the issue and we can retrieve more than 5000 records.

Written by

Krishna Bhanushali

Software Developer

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.

Want to streamline your business processes?

  • This field is for validation purposes and should be left unchanged.

Recent Articles

  • Dynamics 365 Client Diagnostics

    15 March’ 2018

    Main cause of Performance Issues: Bandwidth and latency are the primary characteristics which affects the performance o...

    Read more
  • Closing Blind Shift in MPOS and CPOS in Dynamics 365 for Retail

    15 March’ 2018

    Manual For closing Blind shift in POS: Blind shifts terminate the currently ongoing shift and when logged in a new shif...

    Read more
  • Persistent Filters in the Power BI Service

    13 March’ 2018

    Introduction: The feature is finally release, and it is power BI has announced general availability of persistent filt...

    Read more
  • Cause and Solution for Scribe MSMQ not receiving Message from AX

    10 March’ 2018

    Issue: Microsoft Message Queuing (MSMQ) service running on Server might be unable to receive messages. Therefore, messa...

    Read more
  • User Privileges on SharePoint – D365 Document Integration

    10 March’ 2018

    Overview: Often, we wonder what could be wrong where we see a generic error on Documents in Dynamics 365. Something lik...

    Read more