30 Apr’19

D365 Customer ServiceInfinite_Loop_Fetchxml


While using fetch XML to retrieve records more than 5000 records and if you have multiple entities involve in it. There are chances that you will get into an infinite loop even if you have less than 5000 records.


We have noticed that after 9.0 if you are using the old method to retrieve more that 5000 records using the fetch xml in the script it is possible that you will get the into infilter loop. This happens due to the internal multiplication of table which gives fist and last records id same in fetch xml

You need to make sure that include the header as shown in the below screen

Need to make sure that you have below check condition before calling the fetch next record collection

if (data[“@Microsoft.Dynamics.CRM.fetchxmlpagingcookie”] != null && data[“@Microsoft.Dynamics.CRM.morerecords”] != null && data[“@Microsoft.Dynamics.CRM.morerecords”]==true) {

It has more than 1 record true only than call the next request.


Hope this helps you to solve your infinite loop issue.

Written by

Subhash Mahato

Technical Consultant

Leave a Reply

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

Want to streamline your business processes?

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

Recent Articles

  • Open HTML in Model pop up in D365 CE

    3 December’ 2019

    Introduction When HTML is opened using JavaScript, it can either open in the same window or a different one. This natur...

    Read more
  • Suggest Vendor Payments feature in Payment Journal – NAV/ Business Central

    3 December’ 2019

    Introduction: In this blog, I will be attempting to highlight on Suggest Vendor Payment functionality in Payment Journa...

    Read more
  • How to resolve Error “Exception from HRESULT: 0xC0202009” While data export

    3 December’ 2019

    While  Exporting data using data entity in D365 FO sometimes the Data project fails to export data with error “Ex...

    Read more
  • How to create Tabular Model Project

    30 November’ 2019

    In this blog, we will learn how to create blank Tabular model project. Pre-requisite: Visual Studio with Business Intel...

    Read more
  • How to bring “AI” to Power BI

    28 November’ 2019

    The February 2019 release of Power BI Desktop unveiled a new, out-of-the-box visual to Power BI called Key Influencer...

    Read more

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.