Sample:
We used to be able to pass a FetchXML to this function and get "workflowid" which then we were running the dialog box for the user.
Old Code looked like this:
//This is the FetchXML code to extra the live guids of the workflows
function Fetch(xml) {
var Xml = ""
Xml += GenerateAuthenticationHeader()
Xml += "";
Xml += "";
Xml += "";
Xml += FetchEncode(xml); // Microsoft _HtmlEncode function
Xml += " ";
Xml += " ";
Xml += " ";
Xml += " ";
var XmlHttp = CreateXmlHttpObject(); // Microsot CreateXmlHttp function
XmlHttp.open("POST", "/mscrmservices/2007/crmservice.asmx", false); //Sync Request
XmlHttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
XmlHttp.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/crm/2007/WebServices/Fetch");
XmlHttp.send(Xml);
var XmlDoc = new ActiveXObject("Msxml2.DOMDocument");
XmlDoc.async = false;
XmlDoc.resolveExternals = false;
XmlDoc.loadXML(XmlHttp.responseXML.text);
var resultRecords = XmlDoc.selectNodes("//workflowid");
return resultRecords[0].text;
}
Upgrading to IE10 and we have noticed the selectNodes function returns null. Here is a way we have temporarily replaced the funtionlity by using a JQuery call and pass the SOAP message to the 2007 endpoint:
//This is the FetchXML code to extra the live guids of the workflows
function Fetch(xml) {
var Xml = ""
Xml += GenerateAuthenticationHeader()
Xml += "";
Xml += "";
Xml += "";
Xml += FetchEncode(xml); // Microsoft _HtmlEncode function
Xml += " ";
Xml += " ";
Xml += " ";
Xml += " ";
// the code has been Modified in regards to compatibility issue with IE10
// The end point needs to be replaced with 2011 version and the following with OData call
var soapURL = "/mscrmservices/2007/crmservice.asmx"
var returnValue;
$.ajax({
type: "POST",
contentType: "text/xml; charset=utf-8",
datatype: "xml",
async: false,
url: soapURL,
data: Xml,
beforeSend: function (XMLHttpRequest) {
XMLHttpRequest.setRequestHeader("Accept", "application/xml, text/xml, */*");
XMLHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
XMLHttpRequest.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/crm/2007/WebServices/Fetch");
},
success: function (data, textStatus, XmlHttpRequest) {
var resp = $.parseXML($(XmlHttpRequest.responseXML).children().find('FetchResult')[0].textContent).childNodes[0];
if (resp != null && resp.childNodes[0] != null && resp.childNodes[0].childNodes[0] != null)
{
returnValue = resp.childNodes[0].childNodes[0].textContent;
//$.parseXML($(XmlHttpRequest.responseXML).children().find('FetchResult')[0].textContent).childNodes[0].childNodes[0].childNodes[0].textContent
}
else
{
alert("failure unable to perform this action.");
returnValue = "failure";
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
returnValue = 'failure' + errorThrown;
alert("failure " + errorThrown);
}
});
return returnValue;
}
No comments:
Post a Comment