You need to sign in to do that
Don't have an account?

Need help in Send to phone service of Ajax tool kit
Hi Friends,
I have one scenario in that i need to send the account details to the owner's mobile phone.
I am using the following code to do that. But while executing its asking for the user id and password.
If i gave that also its again loading the same the page.
Please help me to rectify this.
The code is :
<html> <head> <script type="text/javascript" src="/js/functions.js"></script> <script src="/soap/ajax/10.0/connection.js"></script> <script type="text/javascript"> function init() { alert("hi"); var carrier = "{!User.Cell_Phone_Carrier__c}"; alert("hi4"+carrier); if ( carrier == "" ) { alert( "No cell phone carrier specified" + " in your personal information"); setTimeout("window.close();",100); return; } var cell_number = "{!User.MobilePhone}"; alert("hi5"+cell_number); if ( cell_number == "" ) { alert( "No cell phone number specified"+ " in your personal information"); setTimeout("window.close();",100); return; } var l = window.location; alert("hi2"+l.href); if ( l.protocol == "https:") { l.href = l.href.replace(/https/,'http'); alert("hi3"+l.href); return; } sforce.connection.remoteFunction( {url :"http://www.google.com/sendtophone",mimeType: "text/plain",requestHeaders:{"Content-Type":"application/x-www"+ "-form-urlencoded"}, method: "POST", requestData: "gl=US&hl=en"+ "&client=navclient-ffsms"+ "&c=1&carrier="+ carrier+ "&subject={!Account.Name}"+ "&text={!Account.BillingStreet}\n"+ "{!Account.BillingCity}"+ "&mobile_user_id="+ cell_number, async: true, onFailure : done, onSuccess : done}); } function done( response ) { alert("hi6"); document.getElementById('sendtophone'). innerHTML = response; setTimeout("window.close();",5000); } </script> </head> <body onload="init();"> <div id="sendtophone" > </div> </body> </html>
Thanks
Probably because of this. What is this about?
Hi,
Thanks for your immediate reply.
I have Put the code to replace the https to http.
var l = window.location;alert("hi2"+l.href);
if ( l.protocol == "https:") {
l.href = l.href.replace(/https/,'http');
alert("hi3"+l.href);
return;
}
The above code is not replacing the https to http.
Please correct me in the code to do the same.
If i delete the above code its saying the following message :
"400 Endpoint protocol(http/https) mismatch:
http://www.google.com/sendtophone "
Note : I have givent the remote site setting as "http://www.google.com".
Thanks.
I dint fine the solution yet.
Kindly clarify this.
Thanks.