8.5 Understanding Session State Management
When an end user submits a page, sometimes you save their input to application tables immediately. Other times, to improve usability or manage file uploads, you need to store values temporarily and save them later.
The APEX engine manages this temporary storage across each user session, including application values, value collections, and uploaded files. These stored values are collectively known as "session state".
- Use Cases for Temporary Storage
Use temporary storage for multi-page tasks, query-by-example searches, temporary data collections, and file uploads. - Session Context for Temporary Values
A user session is the span of time during which a particular end user interacts with your web application. - How APEX Manages User Session State
For the Onboard New Employee wizard page flow shown below, you only want to insert the new employee row in theEMPtable when the user clicks (Finish) on the last page. - User-Specific Temporary Storage
To store a page item's value as a user preference that spans multiple sessions, set its Session State > Storage property to Per User (Persistent). - Clearing Session State
The APEX engine clears session state values for a user session when it ends. - Application Items
An application item is a named value holder that persists for the duration of the user session. - Using Temporary Collections
Collections let APEX store one or more rows of temporary information. At runtime, you create a named collection with theAPEX_COLLECTIONpackage. A session can contain multiple collections, and APEX clears them automatically when the session ends. - Temporary Files
Both the APEX File Upload and Image Upload page items provide a Storage Type setting of Table APEX_APPLICATION_TEMP_FILES. Both support uploading either single or multiple files. - Inspecting Session State for Debugging
When running your app from App Builder, the developer toolbar appears along the edge of the browser window and offers options useful for debugging.
Parent topic: Understanding Page Flow & Session State