i need to write some variables name value pair which is captured on one page which should be accessible on more than one other pages which have different controllers. what are available options in the platform beside URL parameters and writing values to a sObject.

  • Have you tried Static keyword ?
    – MIX DML
    Jun 6, 2015 at 16:18
  • 1
    @Prabhat Static fields only live for the duration of a single request so are of no help here.
    – Keith C
    Jun 6, 2015 at 16:23

3 Answers 3


At present, the only option would be to store the required values in a custom setting/ custom object as salesforce does not provide a session wide cache.

But, as per Salesforce docs, Salesforce is planning to release a new feature in Winter '16 called Platform Cache, which can solve this purpose. Platform cache would enable developers to store key-value pairs session-wide or org-wide. For more details refer:- https://developer.salesforce.com/blogs/engineering/2015/05/platform-cache.html


As you have noticed there is presently no concept of in-memory session scope so data has to be written and read from the database. One approach is to add a custom text field to the User object and store your data in it as JSON. That keeps each user's data separate but breaks if a user is logged in more than once. So if it isn't too unwieldy, stick to URL parameters.


And platform cache is live!

There are two types of cache:

  • Session cache—Stores data for individual user sessions. For example, in an app that finds customers within specified territories, the calculations that run while users browse different locations on a map are reused. A session cache lives alongside a user session. The maximum life of a session is eight hours. A session cache expires when its specified time-to-live (ttlsecs value) is reached or when the session expires after eight hours, whichever comes first.
  • Org cache—Stores data that any user in an org reuses. For example, the contents of navigation bars that dynamically display menu items based on user profile are reused. Unlike a session cache, an org cache is accessible across sessions, requests, and org users and profiles. An org cache expires when its specified time-to-live (ttlsecs value) is reached.

Here's more detailed use cases from the release notes

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .