Question

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?

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top