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
pavan bommana 5pavan bommana 5 

How to get the session of the org which is logged in another tab in same browser

I want the session id of the org which is logged on another tab through apex or visual force or lightning javascript
Malika Pathak 9Malika Pathak 9

Hi Pavan,

find the below solution

System.debug(UserInfo.getSessionId());

https://salesforce.stackexchange.com/questions/110515/getting-session-id-in-lightning


if you find this helpful mark it as the best answer.

ANUTEJANUTEJ (Salesforce Developers) 
Hi Pavan,

>> https://www.biswajeetsamal.com/blog/get-session-id-using-apex-in-salesforce/

You can try checking the above link that shows a way to get the sessionId in apex.

EDIT: $Api.Session_ID is to get session id in VF page 

UserInfo.getSessionId() - it will work in apex but you cannot get the session id in debug log using it.

Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.  

Thanks.