How to get Session Id using Apex in Salesforce?

To get Session Id using Apex in Salesforce, UserInfo.getSessionId() is used.

Sample Code:

String sessionId = UserInfo.getSessionId().

Note: For Apex code that is executed asynchronously, such as @future methods, Batch Apex jobs, or scheduled Apex jobs, getSessionId returns null.


No comments:

Post a Comment

Sharing is Caring!!! Share this with your friends!!!

submit to reddit