You need to sign in to do that
Don't have an account?

INVALID_SESSION_ID Just started getting it.
Sometime in the past week I had an scontrol stop working with the infamous invalid session id. So I made a test and hoping someone here knows what it's about:
test.page:
<apex:page >
<h1>Congratulations</h1>
This is your new Page
<apex:scontrol controlName="test" width="1" height="1" rendered="true" />
</apex:page>
test.scf:
<script src="/soap/ajax/15.0/connection.js" type="text/javascript"></script>
<script>
try {
var tt = new sforce.SObject("Lead");
tt.Lastname = "test";
tt.Company = "test";
var result = sforce.connection.create([tt]);
}catch(error){
alert("Got error: " + error);
}
</script>
When I load this page, I get:
INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session
Any idea how to make this work?
Thanks!
when you initialize the page , add following code
sforce.connection.sessionId = '{!$Api.Session_ID}';