Skip to main content

Notifications

Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Xrm.WebApi.online.retrieveMultipleRecords no response

Posted on by 2

Hi ,

I am unable to get any response from the Xrm.WebApi.online.retrieveMultipleRecords.using CRM Rest builder.

Below is the snippet

Xrm.WebApi.online.retrieveMultipleRecords("appointment", "?$select=subject,activityid,_createdby_value,createdon,scheduledend,scheduledstart&$filter=_regardingobjectid_value eq '" + opportunityId + "'and statecode ne 1 and statecode ne 3 and contains(subject, 'Week')").then(

Thanks

  • AriaConsulting Profile Picture
    AriaConsulting 2,655 on at
    RE: Xrm.WebApi.online.retrieveMultipleRecords no response

    , how do you come up with this so fast??  Wow!

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Xrm.WebApi.online.retrieveMultipleRecords no response

    Hi EKL,

    I have built api in CRM REST Builder as following screenshot:

    pastedimage1628055334972v1.png

    Then i got following code:

    pastedimage1628056278336v1.png

    Xrm.WebApi.online.retrieveMultipleRecords("appointment", "?$select=activityid,_createdby_value,createdon,scheduledend,scheduledstart,subject&$filter=_regardingobjectid_value eq 3e6166e1-c2c9-eb11-bacc-002248096605 and  statecode ne ne and  statecode ne ne and contains(subject, 'Week')").then(
        function success(results) {
            for (var i = 0; i < results.entities.length; i  ) {
                var activityid = results.entities[i]["activityid"];
                var _createdby_value = results.entities[i]["_createdby_value"];
                var _createdby_value_formatted = results.entities[i]["_createdby_value@OData.Community.Display.V1.FormattedValue"];
                var _createdby_value_lookuplogicalname = results.entities[i]["_createdby_value@Microsoft.Dynamics.CRM.lookuplogicalname"];
                var createdon = results.entities[i]["createdon"];
                var scheduledend = results.entities[i]["scheduledend"];
                var scheduledstart = results.entities[i]["scheduledstart"];
                var subject = results.entities[i]["subject"];
            }
        },
        function(error) {
            Xrm.Utility.alertDialog(error.message);
        }
    );

    But i found some errors in code(I'm not sure what the reason is), so i can't execute it in CRM REST Builder.

    pastedimage1628055548165v3.png

    So i copy the URL:

    pastedimage1628055828544v6.png

    Change the errors:

    orgxxxxxxx.crm.dynamics.com/.../appointments

    Paste it to the URL bar of the browser, then you can get response:

    pastedimage1628056169706v7.png

    Regards,

    Leah Ju

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

  • EKL Profile Picture
    EKL 2 on at
    RE: Xrm.WebApi.online.retrieveMultipleRecords no response

    Thank you, Can you please let me know the code you used to retrievemultiple or how to do via CRM REST Builder.

    pastedimage1627984907980v1.png

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Xrm.WebApi.online.retrieveMultipleRecords no response

    Hi EKL,

    I have created one appointment as your conditions:

     pastedimage1627960097850v1.png

    (1) Regarding field related to the opportunity--01(3e6166e1-c2c9-eb11-bacc-002248096605)

    (2) State is open --statecode is 0

    pastedimage1627960192561v2.png

    (3) Subject field contains 'Week'.

    Then i used same filter to retrieve appointments:

    Xrm.WebApi.online.retrieveMultipleRecords("appointment", "?$select=activityid,_createdby_value,createdon,scheduledend,scheduledstart,subject&$filter=_regardingobjectid_value eq 3e6166e1-c2c9-eb11-bacc-002248096605 and  statecode ne 1 and  statecode ne 3 and contains(subject, 'Week')").then(
    Result:
    pastedimage1627960376488v3.png

    So you need to check all appointments to see if any exist that meet all the conditions.

    Regards,

    Leah Ju

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans