Hi,
I am trying to write a javascript to query the schedules of multiple resources, using the QueryMultipleSchedulesRequest message.
The message is working, but the response is always empty. I don't understand why.
Here's the code:
var Available = "{619FDFC7-2D70-E111-B7D3-1CC1DE086845}"; var TimeCodes = 0; //assemble xml /*Generate Soap Body.*/ var soapBody = "<soap:Body>" + " <Execute xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>" + " <Request xsi:type=\'QueryMultipleSchedulesRequest\'>" + " <ResourceIds>" + Available + "</ResourceIds>" + " <Start>" + Start + "</Start>" + " <End>" + End + "</End>" + " <TimeCodes>" + TimeCodes + " </TimeCodes>" + " </Request>" + " </Execute>" + "</soap:Body>";
alert (soapBody); /*Wrap the Soap Body in a soap:Envelope.*/
var soapXml = "<soap:Envelope " + " xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' " + " xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' " + " xmlns:xsd='http://www.w3.org/2001/XMLSchema'>" + GenerateAuthenticationHeader() + soapBody + "</soap:Envelope>"; /* Create the XMLHTTP object for the execute method.*/ var serverUrl = Xrm.Page.context.getServerUrl() + "/MSCRMservices/2007/crmservice.asmx"; var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); xmlhttp.open("POST", serverUrl, false); xmlhttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8"); xmlhttp.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/crm/2007/WebServices/Execute");
/* Send the XMLHTTP object. */ xmlhttp.send(soapXml); alert (xml http.responseXml.xml); |
There is no error when I send this, just an empty xml response:
![]()
The dates are correctly formatted (I corrected that earlier, it gave an error with the standard CRM dates), I've tried many different values for TimeCodes but I can't seem to get any result.
Any help is greatly appreciated!