Set Session Attribute Action - Documentation topics on: actionlet,rules,session attribute,.

Set Session Attribute Action

Rule Action values can be retrieved dynamically using Velocity code in a Widget, Form, Container, Template, etc., using Velocity code.

Retrieving Action set Session Attributes from a using Velocity

he Action will add to the request a key/value map. With this Action you will only need to send as parameters the key and the value. For example you can add this the the request object: “language”->“es” where “language” is the key and “es” is value.

This Action will add to the backend session a key/value map. With this Action you will only need to send as parameters the key and the value. For example you can add the following to the session: “company”→“dotCMS” where “company” is the key and “dotCMS” is the value.

You could later access this session-stored information in several ways. For example, with Velocity you can pass the key to retrieve the value:

$session.getAttribute(“key")  

Following the example retrieves the value of the key called “company” which had previously set in the Rule:

$session.getAttribute(“company")  

Example return: “dotCMS”

The Parameters of the Action (for REST purposes) are: “sessionKey” and “sessionValue”. Read the Actions REST API documentation for more information on how to set actions to rules via the Actions REST API