Wednesday, January 18, 2023

Create Session Id in Salesforce Using Anonymous window

Here we are going to learn how to create session id in salesforce.

>> Go to Developer console

>> Open Anonymous window

>>Write below code

System.debug(System.URL.getSalesforceBaseUrl().toExternalForm()+
'/secur/frontdoor.jsp?sid='+UserInfo.getSessionId().substring(15));

>> Then click on “execute” button. then Open Log. Click on Debug Only Checkbox. Double click on first line Copy the URL like below screen shot.

OR

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

>> Then click on “execute” button

>> We will get debug log. Click on Debug Only Checkbox and Double click on first line, copy the id like below image

>> Copy Id Paste on below code on notepad.

https://domainname.lightning.force.com/secur/frontdoor.jsp?
sid=00D0o000001RLb5EAG!AQkAQLOJnwVasFxxg9Yqqe2JWnMuSWcnoTc5U64WOWW7JtEABIboVgfVnawr9mZTee1.
imSC1WLCd0biqV7oJV_yHmuF2JLC

>> Replace domainname to your salesforce domain name.And Replace Id to your debug log id.

>> URL paste to other Browsers then directly open Org. And It will be not shown in Login history.

Note: session id will be expired within 24 hours.

No comments:

Post a Comment

Understanding Wire vs Imperative Apex Method Calls in Salesforce Lightning Web Components (LWC)

Understanding Wire vs Imperative Apex Method Calls in Salesforce Lightning Web Components (LWC) Introduction: Salesforce Lightning Web ...