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

sf:INVALID_SESSION_ID plz....send me ideas.....
working fine before. But when i migrated to the latest AJAX API version it is killing me. I marked the code red here is the error
This is the error i am getting in the debug log window.
sf:INVALID_SESSION_ID
INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session
Plz see the code below
I am using this ApI
<script src="/soap/ajax/13.0/connection.js" type="text/javascript"></script>
window.setTimeout(";", 1000);
var date = new Date();
var task= new sforce.SObject("Task");
task.set("Subject", reason);
task.set("Type", "Other");
task.set("LegacyID__c", "SB");
task.set("WhoId", "{!Contact.Id}");
task.set("WhatId", "{!Account.Id}");
task.set("Status", "Completed");
task.set("IsClosed", "true");
task.set("ActivityDate", date);
task.set("Description", notes);
var date = new Date();
var task= new sforce.SObject("Task");
task.set("Subject", reason);
task.set("Type", "Other");
task.set("LegacyID__c", "SB");
task.set("WhoId", "{!Contact.Id}");
task.set("WhatId", "{!Account.Id}");
task.set("Status", "Completed");
task.set("IsClosed", "true");
task.set("ActivityDate", date);
task.set("Description", notes);
var saveResultTask = sforce.connection.create([task]);
for (var i=0; i<saveResultTask .length; i++)
{
if (saveResultTask [i].success == true)
{
}
else
{
alert("An error has occurred: " + saveResultTask [i].errors[0].message);
}
}
changeOwner();
parent.frames.location.replace("/servlet/servlet.FileDownload?file=0153000000042gA");
{
}
else
{
alert("An error has occurred: " + saveResultTask [i].errors[0].message);
}
}
changeOwner();
parent.frames.location.replace("/servlet/servlet.FileDownload?file=0153000000042gA");
}
catch(error)
{
sforce.debug.log(error.faultcode);
sforce.debug.log(error.faultstring);
document.getElementById("divSave").style.visibility='hidden'
document.getElementById("Submit1").disabled = false;
return false;
}
catch(error)
{
sforce.debug.log(error.faultcode);
sforce.debug.log(error.faultstring);
document.getElementById("divSave").style.visibility='hidden'
document.getElementById("Submit1").disabled = false;
return false;
}
It becomes reasonably obvious when you use Firebug to debug just before your login call that the session ID variable is unset, and so you just have to set it before you do anything.
If this is _not_ an Scontrol, then make sure you're not losing your sessionId somewhere in the process. That would also cause this problem. Also, as you surmised, if the user is legitimately timed out then you'll get this issue, in which case the only fix is to get a new sessionId by re-logging in.
hello thanks for your response.
Yes this is an S-control. In the documentation i read that connection.js takes of the session management.
Any way i tried with the statement which you sent (above). I am able to get the sessionID and i put that statement before anything, But still this is not working. Even though success= true It is going to else part, and not executing the alert msg in the else part .whats the reason any one plz.....afterwards going to catch. This is the error msg in the catch if i put it in alert " saveResultTask [i].errors[0] is undefined"
function create() {
sforce.sessionId = getCookie('sid');
sforce.connection.sessionId=sforce.sessionId;
window.setTimeout(";", 1000);
var date = new Date();
//Create Task
var task= new sforce.SObject("Task");
task.set("Subject", reason);
alert("This is Subject");
task.set("Type", "Other");
alert("This is Type");
task.set("LegacyID__c", "SB");
alert("This is Legacy__ID");
task.set("WhoId", "{!Contact.Id}");
alert("THis is Contact id");
task.set("WhatId", "{!Account.Id}");
alert("THis is Account id");
var saveResultTask = sforce.connection.create([task]);
for (var i=0; i<saveResultTask .length; i++)
if (saveResultTask [i].success == true)
{
}
else //It is going to else part means success if false why is this
{
alert("An error has occurred: " + saveResultTask [i].errors[0].message);
}
}
changeOwner(); // it calls another function. I did not mention here due to the large code
parent.frames.location.replace("/servlet/servlet.FileDownload?file=01530000000092gA");
}
catch(error)
{
sforce.debug.log(error.faultcode);
sforce.debug.log(error.faultstring);
document.getElementById("divSave").style.visibility='hidden'
return false;
}
here is my scenario.
on the console,I have a action button. When i click this action button it opens a new window. then on submitting that new window(which redirects to the previous page i.e, console) i am creating a new task.
Exactly this is where i have the issue. It is telling that invalid session ID. plz respond with some idea. Thanks
Message Edited by renu on 07-21-2008 12:48 PM
Hi,
I am also facing the similar kind of issue. I am performing sforce.update(agreementObj) in child window s-control. when click on Submit, it should update the agreement and control should come back to agreeement page. but when clicks on submit, it thrown the following error:
{faultcode:'sf:invalid_session_id; faultstring:"Invalid_sesssion_id:Invalid session ID found in sessionheader: Illegal session'. }