web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

"500 - Internal server error" with batch request in dynamics 365

(0) ShareShare
ReportReport
Posted on by 140

Hi,

We have developed application using Web API and batch request($batch) in Scripting to retrieve records. it give me a error like "500 - Internal server error" and in exception it give message like "server busy". We gone through below links, but not get proper answer.

https://sreenipavalla.wordpress.com/2015/01/06/limitations-of-execute-multiple-request/

https://ideas.dynamics.com/ideas/dynamics-crm/ID0001007

We are not calling multiple request at a time. We call new batch request after the success of existing batch request. We tested our application in all the Microsoft Dynamics CRM versions. We get above error message in Version 8.0, Version 8.1

It work properly in Version 8.2. and Version 9.0.

Anyone can help us to resolve this issue.

*This post is locked for comments

I have the same question (0)
  • JohnAnonymous Profile Picture
    5,241 on at

    Can you post the code, or a sample request?

  • Vikas Negi Profile Picture
    140 on at

    yes sure i will share the code. You know any known  issues of batch request.

  • Vikas Negi Profile Picture
    140 on at

    And we only face this issue on online Dynamics CRM. it works on on-premise properly.

  • Community Member Profile Picture
    on at

    Hi Vikas ,

    please post your code, online crm have a lot of limits on bulk/long time operations.

    Thanks

    If you found the answer helpful, please mark as Verified 

    Join my network on LinkedIn      Follow me on Twitter 

    Thank You & Best Regards

    Francesco Picchi

    Microsoft Dynamics CRM Consultant, Bologna+Milano, ITALY

    Independent Contractor

    http://www.francescopicchi.com

  • Vikas Negi Profile Picture
    140 on at

    //create the fetch              

    var bodyFetch = '--batch_recordfetch\n'

    bodyFetch += 'Content-Type: application/http\n'

    bodyFetch += 'Content-Transfer-Encoding: binary\n'

    bodyFetch += '\n'

    bodyFetch += 'GET ' + crmurl + entitySetName + '?fetchXml=' + fetchxml + ' HTTP/1.1\n'

    bodyFetch += 'Content-Type: application/json\n'

    bodyFetch += 'OData-Version: 4.0\n'

    bodyFetch += 'OData-MaxVersion: 4.0\n'

    bodyFetch += 'Prefer: odata.include-annotations=*\n'

    bodyFetch += 'Access-Control-Allow-Origin: *\n'

    bodyFetch += '\n'

    bodyFetch += '--batch_recordfetch--'

    //create ajax request

    var jqxhr = $.ajax({

       type: "POST",

       contentType: "application/json; charset=utf-8",

       datatype: "json",

       async: false,

       url: crmurl + "$batch",

       data: bodyFetch,

       beforeSend: function (xhr) {

           //Specifying this header ensures that the results will be returned as JSON.

           xhr.setRequestHeader("Accept", "application/json");

           xhr.setRequestHeader("OData-MaxVersion", "4.0");

           xhr.setRequestHeader("OData-Version", "4.0");

           xhr.setRequestHeader("Access-Control-Allow-Origin", "*")

           xhr.setRequestHeader("Prefer", "odata.include-annotations=*");

           xhr.setRequestHeader("Content-Type", "multipart/mixed;boundary=batch_recordfetch");

       }

    });

    var response = { valid: jqxhr.statusText, data: jqxhr.responseText };

  • Vikas Negi Profile Picture
    140 on at

    1072.Capture1.PNG

  • Vikas Negi Profile Picture
    140 on at

    It works in 8.2 and 9.0 version. it give error in 8.0 and 8.1 version only.

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

News and Announcements

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Shidin Haridas Profile Picture

Shidin Haridas 2

#2
Abdullah13 Profile Picture

Abdullah13 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans