You need to sign in to do that
Don't have an account?
BAGEL
Quick Question
Hi all,
Given I have the Session ID and Server ID, how do I access Salesforce data?
I want to access some data from my company website. I have the following code, but it gives me a "responseDOM has no properties" error.
"<script src="https://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js" type="text/javascript"></script>"
function initPage() {
var session = document.getElementById("session").value;
var server = document.getElementById("server").value;
//Get Salesforce connection based on users current session id
sforceClient.init(session, server);
if (sforceClient.getSessionId().indexOf("!API_Session_ID") != - 1){
alert("Could not login using API");
return ;
}
}
What am I missing?
Given I have the Session ID and Server ID, how do I access Salesforce data?
I want to access some data from my company website. I have the following code, but it gives me a "responseDOM has no properties" error.
"<script src="https://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js" type="text/javascript"></script>"
function initPage() {
var session = document.getElementById("session").value;
var server = document.getElementById("server").value;
//Get Salesforce connection based on users current session id
sforceClient.init(session, server);
if (sforceClient.getSessionId().indexOf("!API_Session_ID") != - 1){
alert("Could not login using API");
return ;
}
}
What am I missing?
you can use:
=========
function initPage() {
sforceClient.init("{!API_Session_ID}", "{!API_Partner_Server_URL_70}", true);
}
==========
Message Edited by BAGEL on 04-28-2006 01:04 PM
sforceClient.init("{!API_Session_ID}", "{!API_Partner_Server_URL_70}", true);
When I read a document describe how to do single sign-on for web application, it said using
http://www.mywebsite.com/appexchange.jsp?session={!API_Session_ID}&server={!API_Partner_Server_URL_70}
to pass the Session ID and Server.
it has examples for Java, and C#
but I need to do it with javascript/ajax toolkit. How to do that?
So, if I understand, you are not 'piggybacking' on an existing session, but want to do a fresh login. In that case, you can just call:
sforceClient.login(user, password );
What do you mean by "running outside of salesforce"? From the file system? From konfabulator? From your own web server? Each of this are very different circumstances. If you are running this from your file system for instance, you will never have the merge fields in the init call replaced by anything (the file system doesn't do this and that is essentially "the server" that is serving the page). Same hold true for K, but then, you would not even try the merge fields in this case.
If from your own web server, then you need to obtain the session id and server url as url parameters on the request object as is demonstrated in the java and .NET samples, and replace the two merge fields yourself.