Salesforce Fact #667 | Get current session Id

If we use System.debug() to get the current session Id, it shows SESSION_ID_REMOVED. 

So, in order to get the SessionId we can use a bit of apex logic as below:

System.debug(UserInfo.getOrganizationId()+''+UserInfo.getSessionId().substring(15));

Note: The first 15 char of session Id is the Organization Id.

Reference: https://developer.salesforce.com/forums/?id=9062I000000g6v7QAA

Comments

Popular posts from this blog

Salesforce Fact #192 | Call batch apex from flow

Salesforce Fact #457 | Get current user role name in flow