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 using JavaScript to open a URL and create object using API

I'm using JavaScript to do some Salesforce field updates then open a URL in the same window with a side bar. The following is the last line of JavaScript that calls the button which calls an s-control:

 The lid is the button and the eid is the custom object that the button is being called from. The button opens a link to our service inside the existing window with a sidebar. (The only reason I'm calling this button inside the JavaScript is that I don't know a way to open the URL in this same manner.) Our service tries to create a Salesforce object using the session id of the user as the creator of the object. It is at this point that we get the 'Invalid Session Id - session id has timed out' error. I've logged in as two different users and the session id is the same and I don't think it should be. My guess is that the above link was created specific to that session id, but I don't see how that's possible.
Any thoughts on how to fix or get around this? Much appreciated.

Ok. I fixed this by passing the user session id in the URL of the button.
I am running into the exact same issue. Could you please post your final solution?
I just added the merge fields {!API.Session_ID} and {!API.Partner_Server_URL_70} as parameters to the URL that I was redirecting to.