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
, how do you come up with this so fast?? Wow!
Hi EKL,
I have built api in CRM REST Builder as following screenshot:
Then i got following code:
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.
So i copy the URL:
Change the errors:
orgxxxxxxx.crm.dynamics.com/.../appointments
Paste it to the URL bar of the browser, then you can get response:
Regards,
Leah Ju
Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.
Thank you, Can you please let me know the code you used to retrievemultiple or how to do via CRM REST Builder.
Hi EKL,
I have created one appointment as your conditions:
(1) Regarding field related to the opportunity--01(3e6166e1-c2c9-eb11-bacc-002248096605)
(2) State is open --statecode is 0
(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(
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.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156