Quantcast
Channel: CRM Development forum
Viewing all articles
Browse latest Browse all 8223

ActiveXObject not supporting Other than IE browser.

$
0
0

In my project i have used below mentioned code to retrieve fields.Its working fine in IE but when i use with Firefox and chrome its getting error since ActiveXObject doesnot support other browser.I find the solution, Where they are saying to use odata query.But my project i have used lot of places below code..can any one suggest me for solution.

Thanx in advance..

My code is

function RetrieveEntityVaules(prmEntityName, prmEntityId, prmEntityColumns) {


var returnvalue, errorCount, msg, xmlHttp, arrayEntityColumns, xmlEntityColumns;

arrayEntityColumns = prmEntityColumns.split(",");

for (var i = 0; i < arrayEntityColumns.length; i++) {
xmlEntityColumns += "<q1:Attribute>" + arrayEntityColumns[i] + "</q1:Attribute>";
}

var authenticationHeader = Xrm.Page.context.getAuthenticationHeader();

//Prepare the SOAP message.
var xml = "<?xml version='1.0' encoding='utf-8'?>" +
"<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'>" +
authenticationHeader +
"<soap:Body>" +
"<Retrieve xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>" +
"<entityName>" + prmEntityName + "</entityName>" +
"<id>" + prmEntityId + "</id>" +
"<columnSet xmlns:q1='http://schemas.microsoft.com/crm/2006/Query' xsi:type='q1:ColumnSet'>" +
"<q1:Attributes>" +
xmlEntityColumns +
"</q1:Attributes>" +
"</columnSet>" +
"</Retrieve></soap:Body></soap:Envelope>";

//call function to create Soap Request to ms crm webservice
xmlHttp= new ActiveXObject("Msxml2.XMLHTTP");

 

 

 

xmlHttp.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);

xmlHttp.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/crm/2007/WebServices/Retrieve");

xmlHttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8");

xmlHttp.setRequestHeader("Content-Length", xml.length);

xmlHttp.send(xml);


returnvalue= xmlHttp.responseXML;

var errorCount = returnvalue.selectNodes('//error').length;


if (errorCount != 0) {
var msg = returnvalue.selectSingleNode('//description').nodeTypedValue;
alert("Error Message : " + msg);
}
else {

return returnvalue;
}
}


Arun Kumar G


Viewing all articles
Browse latest Browse all 8223

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>