rbf_getSessionData()
Purpose
For custom user session data, this function returns the value for the specified key 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 one of the following messages:
Empty key received!— No key parameter was passedNo Mappings Set for [key]— There is no value associated with the specified key or there is no custom session data to retrieve
rbf_setErrorsCallback(), you will still see the HTTP
status of 500 but will not see the reason for the error.Syntax
rbf_getSessionData(key, callback);
Parameters
key
A string that is the lookup key for user session data. The maximum length of a key is 50 characters.
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 the value associated with that key (JavaScript
primitive) to callback function and sets the HTTP
status to 200
Example
The following example retrieves the value for the specified key 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_getSessionData("name1", handleSessionData);
</script>
If the specified key does not exist, Platform displays the following alert: