Last active
June 17, 2019 16:44
-
-
Save anilsomasundaran/efbb1f5215a0fe1373289062a34d0a34 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:page controller="LexSessionController"> | |
Start{!$Api.Session_ID}End | |
</apex:page> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LexSessionController { | |
public static String fetchUserSessionId(){ | |
String sessionId = ''; | |
// Refer to the Page | |
PageReference sessionIdPage = Page.LexGetSessionIdPage; | |
// Get the content of the VF page | |
String vfContent = sessionIdPage.getContent().toString(); | |
// Find the position of Start and End | |
Integer startPosition = vfContent.indexOf('Start') + 'Start'.length(), | |
endPosition = vfContent.indexOf('End'); | |
// Get the Session Id | |
sessionId = vfContent.substring(startPosition, endPosition); | |
System.debug('sessionId '+sessionId); | |
// Return Session Id | |
return sessionId; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment