If you do need to store data within OScript for a specific request or user session then you have a few options, including :
- Add it to the Request record
- Add it to the Cache (more info.)
- Add it to the Program Context variable, usually called prgCtx
- Orphan LLIAPI:LLIAPI Root:SessionData call it <modulename>SessionData.
- Add this orphan to the Application Globals.
- Create the features in your new Session object that you require.
- Update <modulename>SessionData:ResetSessionData script to set default values for all the features of your session object so that they are reset correctly for each session.
// register our session object
$LLIAPI.SessionDataSubsystem.RegisterItem(<global name from Application Globals>, "<modulename>SessionData" )
// Load the Session object into a variable
Dynamic sessionObj = $LLIAPI.SessionDataSubsystem.GetItem("<modulename>SessionData")
// Set the feature
sessionObj.<session feature name> = <session value you want to store>
// Load the Session object into a variable
Dynamic sessionObj = $LLIAPI.SessionDataSubsystem.GetItem("<modulename>SessionData")
// Set the feature
<variable to populate from Session> = sessionObj.<session feature name>