Salesforce API global variable in a visualforce page
In salesforce custom links, a user can reference the salesforce session ID by using the API global variable, like so: {!Api.Session_ID}
I have a visualforce page that needs this variable, but it doesn't seem to recognize it. The error message says to create the 开发者_开发问答apex property 'api' in the page's custom controller.
This is my desired use of it: My link
How can I achieve this?
Your issue is easily sorted, global variables are prefixed by $ so what you actually want is
{!$Api.Session_ID}
What you are asking for current is the controller to call a getApi method which would return an object containing a field called Session_ID. It's the $ that lets SFDC recognise a global variable and not a controller method.
Paul
精彩评论