+ Start a Discussion
mba75mba75 

Ajax Proxy

I try to connect a webservice to my salesforces apps With an S-control

The following line return the alert box :Undefined

sforce.connection.remoteFunction({
url : "http://abr.business.gov.au/abrxmlsearch/ABRXMLSearch.asmx/ABRSearchByABN?includeHistoricalDetails=N&authenticationGuid=AAAA-xxxxxxxxxxxxxxx&searchString=9999999999",
onSuccess : function(response) {
alert("result" );
}
});

If paste my url into a ie browser I get my XML doc .

Any Idea ?:smileysad:


cheenathcheenath
Pass in a onFailure method and see what the error message is.

sforce.connection.remoteFunction({
url : "http://abr.business.gov.au/abrxmlsearch/ABRXMLSearch.asmx/ABRSearchByABN?includeHistoricalDetails=N&authenticationGuid=AAAA-xxxxxxxxxxxxxxx&searchString=9999999999",
onSuccess : function(response) {
alert("result" );
},
onFailure: function(error) {
  alert("Got error " + error);
}
});

mba75mba75
There is no onfailure message :

I just get an alert box :  undefined.


cheenathcheenath
Do you include connection.js in your scontrol? Can you post your full scontrol?





mba75mba75
The Full S-control is really long .

How do you include the connection.js ?

Do you have to create a snippets and include the snippet in your code?






cheenathcheenath
Here is a sample scontrol, see if this works for you:

Code:
<html>
<!--
Generated by AJAX tools
Date : Thu Feb 14 2008 15:50:46 GMT-0800 (PST)
Template : simple.html by manoj@cheenath.com
SControl : RemoteFunction
-->
<head>
<script src="/soap/ajax/11.0/connection.js"></script>

<script>
  sforce.connection.remoteFunction({
    url : "http://www.cheenath.com",
    onSuccess : function(response) {
      alert("Got response" + response);
    },
    onFailure : function(error) {
      alert("ERROR: " + error);
    },
    async: false
  });
</script>


</head>
<body>
Body of the scontrol here
</body>
</html>

 


mba75mba75

Thank you Cheenath
Apparently I go thropught Th remote connection fuction now .

I have another error behind

Last question :

Can I upload my own javascript file ?




cheenathcheenath
I think you can save them as S-Control snippet.


sfdcfoxsfdcfox
You can use the "Browse" option on the S-Control to upload a JavaScript file, or define a "static resource" and refer to that file (Setup | Develop | Static Resources), or host the file on an external server and simply link it in. You can use whichever method will best work for the application you're designing.