function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
pfarrellpfarrell 

Help with RemoteFunction

I am trying to use a remoteFunction to get the names and ids of reports currently available to the logged in account.  Here's the function I'm using
Code:
sforce.connection.remoteFunction({
async : false,
//mimeType: 'text/xml',
cache : true,
url : '{!API.Partner_Server_URL_60}'.substring(0,26) + '/servlet/servlet.ReportList?sessionid={!API.Session_ID}',
onSuccess : reportsReady,
onFailure : errorReport
});

function reportsReady(response) {
alert(response);
}

function errorReport(error) {
alert('error:' + error);

When I load the generated url in a browser, I get an xml listing of my account's reports.  When run through AJAX,  it generates the errorReport with the following response:
Code:
<xml version="1.0">
<result>
</result>
Does anyone see anything wrong with the way I'm going this?

Message Edited by pfarrell on 09-12-2007 07:08 AM

pfarrellpfarrell
As an amendment, I've found a hint about why this is failing...

Using Firebug, I can see that I'm getting an error when AJAX tries to load the following location:

https://na5.salesforce.com/services/proxy?end-point-url=https://na5.salesforce.com/servlet/servlet.ReportList?sessionid=[redacted_session_Id]


If I try to load that location in a browser, I get the following error:

SalesforceProxy-Endpoint not defined in header

This is presumably because the remoteFunction call adds something to the header.
cheenathcheenath
remoteFunction is only need if you are calling an external server. If you are calling
back to salesforce.com you can make the call directly.



pfarrellpfarrell
That makes sense.  Thanks Cheenath.