You need to sign in to do that
Don't have an account?
agab
remoteFunction call on Visualforce page does not work with IE
Hello,
I am making a sforce.connection.remoteFunction call on a Visualforce page. This works fine with Firefox, but with IE I get the following error: "Type mismatch". Has anyone experienced this before?
Thanks,
agab-
I completely forgot that I had this exact same problem with another client and that that client had premier support who eventually provided a fix. Simply add the line...
sforce.connection.sessionId = "";
... anywhere in your JavaScript before you make the call to sforce.connection.remoteFunction.
All Answers
Hi everyone,
I have the same problem, does any of you have the answer?
My code only works for Firefox:
function CallWS() { var days = 0; var credit = 0; try { var myCode = '{!Custom_Object_ID}'; var envelope = '<?xml version="1.0" encoding="utf-8"?> ' + '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> ' + '<soap:Body> ' + '<ValidateCredit xmlns="http://tempuri.org/"> ' + '<clientID>' + myCode + '</clientID> ' + '</ValidateCredit> ' + '</soap:Body> '+ '</soap:Envelope> '; sforce.connection.remoteFunction ( { url: "http://www.mydummyservice.com:9078/services/Service.asmx", requestHeaders: { "Content-Type": "text/xml; charset=utf-8", "SOAPAction": "http://tempuri.org/ValidateCredit" }, requestData: envelope, method: "POST", async: false, onSuccess: function(response) { days = customParseXML(response, 'Field1'); credit = customParseXML(response, 'Field2'); alert('My response: days = ' + days + '. credit = ' + credit); }, onFailure: function(response) { alert('Error response: \n\n'+response); } } ); } catch(excepcion) { alert("Catched error: \n" + excepcion + " - " + excepcion.message + "\n\n Please contact the admiinstrator."); } } function customParseXML(response, myfield) { var MyResult; if (window.DOMParser) { parser=new DOMParser(); xmlDoc=parser.parseFromString(response,"text/xml"); MyResult = xmlDoc.getElementsByTagName(myfield)[0].childNodes[0].nodeValue; } else // Internet Explorer { xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async="false"; xmlDoc.loadXML(response); MyResult = xmlDoc.getElementsByTagName(myfield)[0].childNodes[0].nodeValue; } return MyResult; }
This code works fine from a Javascript custom button in salesforce, but, when I added it in a Visualforce page, it only works in FireFox, not in IE.
I already know it is possible to call it from ApexCode, but we'd like to test this way.
So, does anybody have an answer to this case?
Regards,
Wilmer
I completely forgot that I had this exact same problem with another client and that that client had premier support who eventually provided a fix. Simply add the line...
sforce.connection.sessionId = "";
... anywhere in your JavaScript before you make the call to sforce.connection.remoteFunction.