Hello everyone,
I have one problem on getting Schedule for multiple users at once using "QueryMultipleSchedules" function i previously used "QuerySchedule" function to get single users Working hours but it is not feasible to get 100 Users working hours at once.
- So i tried "QueryMultipleSchedules" documentation and Code in CRM Rest builder but when i execute that code i get below error.
Can someone help me out with this problem or how can i perform this function in better way.
- Also how can i pass multiple resource id in api Request.
Error:
- bad Request:
- Expected literal type token but found token '{\"REPLACE_WITH_PRIMARY_ID_ATTRIBUTE\":\"0\",\"@odata.type\":\"Microsoft.Dynamics.CRM.TimeCode\"}'."
Code(JQuery):
$.ajax({
type: "GET",
contentType: "application/json; charset=utf-8",
datatype: "json",
url: Xrm.Page.context.getClientUrl() + "/api/data/v9.1/QueryMultipleSchedules(Resource=@Resource,Start=@Start,End=@End,TimeCodes=@TimeCodes)?@Resource={\"resourceid\":\"123-456-789-123-456-78\",\"@odata.type\":\"Microsoft.Dynamics.CRM.resource\"}&@Start=2020-10-20T01:00:00.000Z&@End=2020-10-31T03:30:00.000Z&@TimeCodes={\"REPLACE_WITH_PRIMARY_ID_ATTRIBUTE\":\"0\",\"@odata.type\":\"Microsoft.Dynamics.CRM.TimeCode\"}",
beforeSend: function (XMLHttpRequest) {
XMLHttpRequest.setRequestHeader("OData-MaxVersion", "4.0");
XMLHttpRequest.setRequestHeader("OData-Version", "4.0");
XMLHttpRequest.setRequestHeader("Accept", "application/json");
},
async: true,
success: function (data, textStatus, xhr) {
var results = data;
},
error: function (xhr, textStatus, errorThrown) {
Xrm.Utility.alertDialog(textStatus + " " + errorThrown);
}
});