How to a create session table in Jitterbit App Builder
All interactions with App Builder occur within the context of a web "session". A session is created when a User first visits App Builder, and subsequent requests from the same User are associated with the same session. This guide will step you through how to create a Session table in App Builder, and then associate it with a Rule and an Event.
Business use cases for sessions
- Track and distinguish between authenticated Users under the same account. For example, if two people are both signed in as an Admin User, Sessions allows you to track them individually.
- Track multiple anonymous Users
- Filter report criteria based on session
To create a session table
The first step is to create the Session table in the Data Storage Layer.
- Navigate to the App Workbench
- Click + Table
- Assign the Name as Session, and click Save
- Confirm a UUID Primary Key Column has been created for SessionID
- Add any remaining Columns you need that are relative to your session. This is specific to application needs.
- Click the Enhance Table button and Proceed
The second step is to create a Default Rule against the Session table.
Important
You do not need to insert a Table in this Rule definition. This can work using a Parameter table, as there is only every one record. If you use a multi-record table, it will likely break the Default Rule.
- Navigate to the App Workbench > Rules
- Select By Table, then select the Session table from the Tables panel
- Click the + Rule button from the Rules panel
- Set the Purpose to Default
- Assign the Name as Session (New Session Default)
- Click Save
- App Builder will automatically add the Session table to your Business Object, which should be deleted
- Click the Columns tab
- Click the + Column button add the expression session(), targeting SessionID, and assign an Alias as SessionID
- Click Save
The third step is to register the Default Rule so that when a new record is inserted, it defaults to the SessionID.
- Navigate to the App Workbench > Rules
- Select By Table, locate the Session table and click Open Record
- Click on More > Edge Case
- Click the Defaults button
- Click the Register Existing button
- Set the Rule to Session (New Session Default)
- Set the Binding Type to Explicit
- Click the Save button
The fourth step is to create a custom Event referencing an Intrinsic App Builder Event that runs when querying the table via the application User Interface.
- Navigate to the App Workbench > Rules
- Select By Table, locate the Session table
- Click the Events icon for the Session Table
- Click + Table Event on the Data Storage Events panel
- Assign the Name as Filter
- Click Save and exit the window
- Click Register Existing under Actions
- Change the Type value to Plugin
- Select the Plugin named "Create row on empty table". This plugin will create a new row if the Filter Event returns no rows.
- Enter Technical Help description
- Click the Save button