Salesforce: SF:INVALID_SESSION_ID

I was constantly getting exception when I tried to use the “/soap/ajax/15.0/connection.js” in the VF Page.
JavaScript throws following exception:-

Invalid SessionID

{faultcode:'sf:INVALID_SESSION_ID', faultstring:'INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session', detail:{UnexpectedErrorFault:{exceptionCode:'INVALID_SESSION_ID', exceptionMessage:'Invalid Session ID found in SessionHeader: Illegal Session', }, }, }

The exception was resolved when I added following statement before using the “sforce.connection” object in the JavaScript.

sforce.connection.sessionId = “{!$Api.Session_ID}

🙂

Leave a Reply