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
sfadm sfdevsfadm sfdev 

Stale Session Exception - The page you submitted was invalid for your session

I experience the following exception:
Stale Session Exception The page you submitted was invalid for your session. Please try your action again.
every time I execute the following javascript code:
 
// Get the URL String.
var recordURL = document.URL;
var URLlength = recordURL.length;

// Get the record ID from the URL.
// Id length of Opportunity object is 15
var opportunityId = recordURL.substring((URLlength - 15), URLlength);
alert("opportunityId " + opportunityId);
var confirmationToken = chatter.getToolbox().token();
alert("confirmationToken " + confirmationToken);

// Unlock the opportunity record
if ((Modal.confirm && Modal.confirm('Are you sure?')) || (!Modal.confirm &&
window.confirm('Are you sure?'))) navigateToUrl('/_ui/core/entitylock
/LockHandler?id=' + opportunityId + '&un=1&_CONFIRMATIONTOKEN=' +
confirmationToken + '\',\'DETAIL\',\'unlock\'');
The value from confirmationToken alert is different from the value in the HTML page source.
Could you please explain why the chatter.getToolbox().token(); returns different results/values.
Could you please advise an appropriate solution to the Stale Session Exception I get?