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
Robert Davis 16Robert Davis 16 

sforce.connection.remoteFunction( ) on Visualforce Page

Using Salesforce Classic I am able to access an Contract Managment System by using a JavaScript Button with the standard Salesforce Page, but when I attempt to use a Visualforce Page with the following code, I get the following error:
 
{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/10.0/apex.js")} 

//Should not have to change this at all 
function getEOSInfo(objectid,objecttype,callback) { 

var baseUrl = "{!$Api.Partner_Server_URL_260}".substring(0, "{!$Api.Partner_Server_URL_260}".indexOf("/services")); 
var url = baseUrl +"/services/apexrest/SpringCMEos/eosinfo?objecttype="+objecttype+"&objectid="+objectid; 
var authkey = "Bearer {!$Api.Session_ID}"; 

sforce.connection.remoteFunction({ 
url : url, 
method:"GET",
requestHeaders: {"Authorization":authkey,"Accept":"application/json"}, 
onSuccess : function(response) { 
var eosInfoResponse = JSON.parse(response); 
callback(eosInfoResponse); 
alert(response);
} 
}); 
} 


//Here you write your own code, this is a simple call 
var objectid = "{!Account.Id}"; 
var objecttype = "Account"; 

getEOSInfo(objectid,objecttype,function(eosInfo){ 

var formuid = "ab227d3b-188c-e711-9c0d-3ca82a1e3f41"; 
var url = "https://uatna11.springcm.com/atlas/Forms/UpdateFormDoc.aspx?aid=7284&FormUid=" + formuid + "&SFID=" + eosInfo.SFId + "&SFTYPE=Salesforce.Account&SFPATH=" + eosInfo.FolderPath + "&ru=%2Fatlas%2Fbpm%2FWorkList.aspx"; 

window.open(url); 

});
AJAX Error

Need to desperately get this working, Can you help with pointing me to the right code?

It appears, best I can tell, to be a problem with the function sforce.connection.remoteFunction( ), but I do not really understand what is happening.

Thank you in advance.

Robert