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

INVALID_SESSION_ID when returning to sControl via retURL

I have an sControl in a popup window that contains a link to edit a Task.  The link is formatted like this...


The link works fine, and I'm able to edit the Task record.  When I save the Task, I am redirected back to the sControl, but I am getting an INVALID_SESSION_ID fault.

Any ideas?
Execute EZSAASExecute EZSAAS
You will need to append "ic=1"
Thanks for responding!

I added the parameter, but I still get the same error.

Here is the Javascript that I'm now using to build the link.

return "<a href='/" + taskId + "/e?retURL=/servlet/servlet.Integration?lid=01NT0000000CiGK&ic=1'>Edit</a> | <a href='#' onclick='deleteLogEntry(\"" + taskId + "\");'>Del</a>";

The delete link works fine since I never leave the page, but the Edit link still throws the INVALID_SESSION_ID error.

The strange thing is that I can use this same sControl on the home page (wrapped in an iFrame) and it works perfectly, including returning to the home page after editing the Task.
Ron HessRon Hess
this is usually due to the session id missing from the pop up'ed window.
examine the src of the page that works, and the src of the page that fails, you may see a missing script tag, looks like this:

<script type="text/javascript">__sfdcSessionId = [...deleted

if you don't have that tag, the ajax library does not have a session id to operate with.
you can set this variable explicitly in your scontrol using the sessionid merge field.

this script tag is inserted by the server if it believes you are running an scontrol, you may have this script tag missing for some reason.
I added this line to the <head> of the sControl, but still no luck.  I might try setting a cookie next.

<script type="text/javascript">__sfdcSessionId = "{!$Api.Session_ID}"</script>

Ron HessRon Hess
when you look at the source of the control in the browser , do you see the session id expanded ? or does it still say {!$Api.Session_ID} ?
It is expanded and appears valid.
Ron HessRon Hess
sorry, i'm out of ideas on this one, you may have to debug it.

if you have firebug installed you can easily capture the request that triggered the API fault ( using firefox net feature to observe the network traffic AJAX)

this will let you see if the soap request has a proper SID in it or not
var caseId = '{!Case.Id}';               window.location="" + caseId + "&problemType=4";

This calls S-Control2 below

var result=sforce.connection.query("select Id, Problem_Type__c from Case");
var records1=result.getArray("records");
var record1 = records1[0];

The caseId from [S-Control1] is being sent successfully from one S-control to the other but I can not access the Case Object in [S-Control2]

Firebug is giving me the following error:
uncaught exception: {faultcode:'sf:INVALID_SESSION_ID', faultstring:'INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session', detail:{fault:{exceptionCode:'INVALID_SESSION_ID', exceptionMessage:'Invalid Session ID found in SessionHeader: Illegal Session', }, }, }