You need to sign in to do that
Don't have an account?
getting error, when querying using ajax toolkit.
Hi i want to use ajax toolkit for my project, however when trying one of the example i m getting this error again and again
{faultcode:'sf:INVALID_SESSION_ID', faultstring:'INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session', detail:{UnexpectedErrorFault:{exceptionCode:'INVALID_SESSION_ID', exceptionMessage:'Invalid Session ID found in SessionHeader: Illegal Session', }, }, }
Here is the VF page.
Thanks
Abhilash
{faultcode:'sf:INVALID_SESSION_ID', faultstring:'INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session', detail:{UnexpectedErrorFault:{exceptionCode:'INVALID_SESSION_ID', exceptionMessage:'Invalid Session ID found in SessionHeader: Illegal Session', }, }, }
Here is the VF page.
<apex:page > <body><button onclick="setupPage();"> dev </button> <div id="output"></div> </body> <script src="../../soap/ajax/35.0/connection.js" type="text/javascript"></script> <script> function setupPage() { sforce.connection.query('select id from lead', {onSuccess : layoutResults, onFailure : queryFailed, source : { output : document.getElementById("output"), startTime : new Date().getTime() } }); } function queryFailed(error, source) { alert('hello 1'); source.output.innerHTML = error; } /** * This method will be called when the toolkit receives a successful * response from the server. * @queryResult - result that server returned * @source - state passed into the query method call. */ function layoutResults(queryResult, source) { alert('hello 2'); if (queryResult.size > 0) { var output = ""; //get the records array var records = queryResult.getArray('records'); //loop through the records and construct html string for (var i = 0; i < records.length; i++) { var account = records[i]; output += account.Id + " " + account.Name + " [Industry - " + account.Industry + "]<br>"; } //render the generated html string source.output.innerHTML = output; } } </script> </apex:page>Need Help !!
Thanks
Abhilash
You need to set sessionId to sforce.connection.sessionId variable.
put
just before line number 8 in your code.
Thanks,
- thatherahere
All Answers
You need to set sessionId to sforce.connection.sessionId variable.
put
just before line number 8 in your code.
Thanks,
- thatherahere
Thanks thatherahere,
Can I use this for Ajax portal login for my Force.com site. here is what I am asking?
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000D85JIAS
I commented on your question.
Please mark this question as SOLVED if my previous reply worked for you. This will help other people here.
- thatherahere