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
ICM Admin 6ICM Admin 6 

Userinfo.getSessionId() Not Valid On Lightning Context.

Hi Everyone,

I have created an automated process through process builder and process builder calling Apex Class 
See below Apex class which is called from process builder ----- code sample

    global without sharing class ICM_ProcessInvocableClass{    
    @InvocableMethod(label='ICMServiceClass' description='')
    global static void callICMServiceBus(List<String> RecordIdList) {
        string sessionToken = UserInfo.getSessionId(); 
        system.debug('@@@@sessionToken:-- '+sessionToken);
        system.debug('@@@@UserTheme:-- '+userinfo.getUiThemeDisplayed());
        ICM_ServiceBusAPICallClass.CallICMServiceAPI(eachRecId,sessionToken);                
       
   }
}
To pass session id to CallICMServiceAPI method (@feature Method),
The above class called from process builder when our opportunity record is created or edited.

if i edited opportunity record in lightning context our session id is invalid.

please give me solution in this.
 
jigarshahjigarshah
I know this is old thread and may ave already been addresses or not be relevant but I see a solution for this has been fixed with the Winter 18 release and hence sharing it wiht you.

Please refer to the following Known issue thread (https://success.salesforce.com/issues_view?id=a1p3A000000EAUPQA4) that talk about it. Hope it helps.

Please mark the thread as SOLVED and answer as the BEST ANSWER if it helps address your issue.
Saket Sharma 37Saket Sharma 37
Hi,

From Winter 18 when u debug session id u will not be able to see but u will get the id in the variable and can be used as per requirement.

Thanks
Saket Sharma