/ Published in: Other
Credits to Andrew Albert
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
Visualforce Page <apex:page setup="true" controller="MyController" showHeader="false"> <apex:form > <apex:outputpanel id="counter"> <apex:outputText value="Click Here To Generate Session Id and Server URL" /> <apex:actionSupport event="onclick" action="{!doLogin}" rerender="refreshId" status="counterStatus"> <apex:param name="sessionId" assignTo="{!apiSessionId}" value="{!$Api.Session_ID}" /> <apex:param name="serverURL" assignTo="{!apiServerURL}" value="{!$Api.Partner_Server_URL_140}" /> </apex:actionSupport> <apex:outputPanel id="refreshId"> </apex:outputPanel> </apex:form> </apex:page> Controller Apex Class public class MyController { public String apiSessionId {get;set;} public String apiServerURL {get;set;} public PageReference doLogin(){ System.debug('apiSessionId: ' + apiSessionId); System.debug('apiServerURL: ' + apiServerURL); return null; } }