rbf_getAllSessionData()

Purpose

For custom user session data, this function returns a hashmap of all key/value pairs for that user and passes it to the specified callback function. See User session data for more information about custom user session data.

If this function raises an error, Platform sets the HTTP status to 500 and invokes the callback function provided via rbf_setErrorsCallback() and passes that function the following message:

  • No Custom Session Data is Set by User — No custom session data exists for the user

Note: If this function call results in an error, and you have not configured a callback function using rbf_setErrorsCallback(), you will still see the HTTP status of 500 but will not see the reason for the error.

Syntax

rbf_getAllSessionData(callback);

Parameters

callback

The callback function that will receive a JSON array of picklist items as its first parameter.

Note: This API is not supported in portals.

Return value

If successful, passes a hashmap of all existing key/value pairs to callback function and sets the HTTP status to 200

Example

The following example retrieves a hashmap of all key/value pairs and outputs it to the console. If there is an error, the callback function displays an alert with an error message:

<script>
  var callback = function(errMsg, apiName) {
      alert("ERROR: "+errMsg+" in: "+apiName);
      };
      rbf_setErrorsCallback(callback);
  var handleSessionData = function (dataValue) {
    if(console){
      console.log("**** Processing handleSessionData ****");
      console.log("Data Value is: ", dataValue);
    }
  }
  rbf_getAllSessionData(handleSessionData);
  </script>

Sample output for this example:

Data Value is:  Object {name2: "Jim", name1: "John"}