Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Facing issue with Xrm.WebApi.retrieveMultipleRecords request

Posted on by 10

Hi Team,

We are working to retrieve records using Xrm.Web.retrieveMultipleRecords request with the help of fetchxml but the result doesn't return nextLink value to get the set of records of the next page. We are facing this issues with only the fetchxml, as its working properly with Odata Query. Here’s the code:

 

function retrieveAllRecords() {

    var accountFetch = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>" +

  "<entity name='account'>" +

    "<attribute name='name' />" +

    "<attribute name='primarycontactid' />" +

    "<attribute name='telephone1' />" +

    "<attribute name='accountid' />" +

    "<order attribute='name' descending='false' />" +

  "</entity>" +

"</fetch>";

 

    accountFetch = "?fetchXml=" + encodeURIComponent(accountFetch);

 

    Xrm.WebApi.retrieveMultipleRecords("account", accountFetch).then(

    function success(result) {

        if (result.nextLink != undefined) {

            Xrm.Utility.alertDialog("page found");

        } else {

            Xrm.Utility.alertDialog("page not found");

        }

    },

    function (error) {

        Xrm.Utility.alertDialog(error.message);

    });

}

 

Could anyone please let us know if there any issue with fetchxml or it a limitation of WebApi.

Thanks,

Vikas

*This post is locked for comments

  • Facing issue with Xrm.WebApi.retrieveMultipleRecords request
    Try to add "?fetchXml=" in your first row, like that
     "?fetchXml=<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>" 
  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Facing issue with Xrm.WebApi.retrieveMultipleRecords request

    Yes, I can use the "?select=...." version to get it works.

    But all I have is the fetchxml, can anyone suggest how can I get it working?

    thanks

    Ken

  • erhan.keskin Profile Picture
    erhan.keskin 2,247 on at
    RE: Facing issue with Xrm.WebApi.retrieveMultipleRecords request

    Hi,

    If you use the query like "?$select=name" and give maxPageSize then it works.

    But for a FetchXml, it does not work.

    Let us know if you have it worked.

    Regards,

  • Suggested answer
    Saad Kabarousse Profile Picture
    Saad Kabarousse 732 on at
    RE: Facing issue with Xrm.WebApi.retrieveMultipleRecords request

    Hello,

    You can use CRM RestBuilder Solution, it will build you the request and you can also it gives a screen that allows you to test your request.

    github.com/.../CRMRESTBuilder

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!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans