1. Home
  2. General
  3. Storing Session Information

Storing Session Information

Overview

Occasionally, you may want to save a variable for use in other applications. The User Session Template allows you to do so, offering improved user convenience and security.

For instance, a user can select a variable to be stored, such as product number, and that variable’s value can be called through multiple applications, without having to make additional selections. Additionally, stored variables can be hidden within a page, rather than passed through a URL, improving security and clearing up how the URL appears to the end user.

Implementation

Create a new retrieval using the User Session Template over a table that contains the field for which you want to save a value. In my example, I would like to save the customer number and product number, or CUSNO and PRDNO fields.

If the field name does not matter, you can create this over any table/field. The name of the field will be used later to retrieve and store the session value.

Note that a user will not interact with this template directly. Set the field value in-session at runtime via the HTML page which contains a form. Alternatively, you can set this value via a URL, for instance,

  1. MRCWORKLIB.I00001s?save_session=1&CUSNO=100001&PRDNO=A100&redirect=MRCWORKLIB.I00002s
  2. In this URL, I am calling the retrieval created in step 2. Notice that I am storing both the customer number and product number. Lastly, I am redirecting to the application in which I want to use these stored variables.

  3. Now, you can reference a stored value via ${visitor.property(‘FIELD’)} within the HTML of whichever applications will be using this value. In my case, using either ${visitor.property(‘CUSNO’)} or ${visitor.property(‘PRDNO’), to do so.
  4. Optionally, you can secure applications by this value just like you would with record level security. Simply use this session application as you would a row level security template application. This object would be called via the record selection screen, using row level security for the relationship, and then selecting the retrieval created in step two as the application from the dropdown list. If you choose to use a session application as a record selection be sure you recompile the application to which it is being added.
Updated on August 4, 2023

Was this article helpful?

Related Articles

Need Support?
Can't find the answer you're looking for? Don't worry we're here to help!
CONTACT SUPPORT