Using Custom Code to Set a Session Storage Key

Overview

This document outlines how to use a Custom Code Action to set a key-value pair in the browser's Session Storage. This allows for storing data that persists only for the duration of a single page session.

How It Works

To set a session storage key, insert a Custom Code Action into your process. Use the sessionStorage.setItem() JavaScript method within this action.

Syntax:
sessionStorage.setItem('yourKeyName', 'yourValue');

Example:
To set a key named enableNewDesktopAiView to the value true, use the following code:
 

javascript
sessionStorage.setItem('enableNewDesktopAiView', 'true');

Limitations

Data stored in sessionStorage is temporary. It is cleared when the page session ends, which occurs when the browser tab or window is closed.

Related Info

You can verify that the key has been stored correctly by using your browser's developer tools. Open the tools, go to the "Application" tab, and inspect the contents under "Session Storage" for the relevant domain. Your key and value should be visible there.