Asked by:
DOM exception in Javascrript XML Http Request in Google Chrome> how to resolve that?

Question
-
Hello experts,
I am using polarisversion CRM online. while testing with chrome Javascript in Google Chrome .I got DOM exception for XML Http Request open() method while creating an email.How can I solve this error.
Thanks and regards
Murali
Tuesday, August 6, 2013 11:59 AM
All replies
-
It would be helpful if you posted the relevant code.
Jason Lattimer
My Blog - Follow me on Twitter - LinkedInTuesday, August 6, 2013 1:18 PMModerator -
function CreateEmail(tableId) {
if (emailDeliveryMethod.Value == 0 || emailDeliveryMethod.Value == 1 || emailDeliveryMethod.Value == 2) {
var data = "";
if (document.getElementById("btnEmail").value != "Open Email") {
var ODataPath = serverurl + "/XRMServices/2011/OrganizationData.svc";
var emailRecord = {};
var tbl = document.getElementById(tableId);
var len = tbl.rows.length;
if (tableId == "tblRoute") {
for (var i = 1; i < len; i++) {
data += "<br><br>" + tbl.rows[i].cells[0].innerHTML + "<br>";
if (tbl.rows[i].cells[1] != null && tbl.rows[i].cells[2] != null && tbl.rows[i].cells[3] != null)
data += " " + tbl.rows[i].cells[1].innerHTML + ' ' + tbl.rows[i].cells[2].innerHTML + " " + " [" + tbl.rows[i].cells[3].innerHTML + " Miles]";
}
}
else
for (var i = 1; i < len; i++) {
if (tbl.rows[i].cells[0] != null && tbl.rows[i].cells[1] != null && tbl.rows[i].cells[2] != null)
data += " " + tbl.rows[i].cells[0].innerHTML + ' ' + tbl.rows[i].cells[1].innerHTML + " " + " [" + tbl.rows[i].cells[2].innerHTML + " Miles]<br>";
}
emailRecord.Description = data;
emailRecord.Subject = "Sending Provider Details";
emailRecord.RegardingObjectId = { Id: userId, LogicalName: "contact" };
var createNewEmail = new XMLHttpRequest();
createNewEmail.open("POST", ODataPath + "/EmailSet", true);
createNewEmail.setRequestHeader("Accept", "application/json");
createNewEmail.setRequestHeader("Content-Type", "application/json; charset=utf-8");
createNewEmail.onreadystatechange = function () {
onEmailCreateCallBack(this);
};
createNewEmail.send(JSON.stringify(emailRecord));
}// callback function
function onEmailCreateCallBack(createEmailReturnValue) {
if (createEmailReturnValue.readyState == 4 /* complete */) {
if (createEmailReturnValue.status == 201) {
var createEmailReturnValue = JSON.parse(createEmailReturnValue.responseText).d;
if (createEmailReturnValue != null) {
if (createEmailReturnValue.ActivityId != null) {
//alert("Retrieved the EmailId \"" + createEmailReturnValue.ActivityId + "\". This Email was created on : \"" + createEmailReturnValue.CreatedOn + "\".");
activityId = createEmailReturnValue.ActivityId;
}
}
CreateActivityparty(activityId, OwnerId, "systemuser", 1);
CreateActivityparty(activityId, userId, "contact", 2);
if (emailDeliveryMethod.Value == 2 &&( document.getElementById("lblHeading").innerHTML == "Selected Provider's Detail" || document.getElementById("lblHeading").innerHTML == "Route Planner")){
document.getElementById("btnEmail").value = "Open Email";
}
alert("Email Created Successfully");
}
else
alert("Error occured while Creating Email.");
}I am using a bove code in polaris version Google Chrome. I got exceptin at req.open() method.
Tuesday, August 6, 2013 1:55 PM -
I will suggest you to use Validation tool to validate your script, which can stopped working on other browsers.
Our Website | Our Blog | Follow US | My Facebook Page | Microsoft Dynamics CRM 2011 Application Design
Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.Tuesday, August 6, 2013 5:35 PMModerator -
Hi,
I validate the script ,while debugging in jquery file(sdk.jquery.js) the DOM exception. I validated that script using that validation tool no issues. How can I handle HTTP Request in othere browsers ,while req.open() I got DOM Exception in chrome.
thanks and regards
Muralikrishan
Wednesday, August 7, 2013 8:33 AM