Introduction

Overview
You can imagine these name value pairs are stored as follows:
Why are they Useful?
- Default Time zone
- Default language
- Notification preference
- Default home screen
- Default unit of measure
- URL to profile picture
- etc.
Use Case
Here is a screen shot of the a sample preferences page which I created where the user can set their default dashboard view.
Setting Preferences
There are two ways to set a preference value.
1. Declaratively in a Page Process
One of the great things about user preferences is that you can set a user preference declaratively (no code) using a page process. The below page process is set to run when the user clicks the ‘Apply’ button (from our example above). When it runs, the user preference ‘DASHBOARD_VIEW’ is set to the current value of the page item ‘P3_DASHBOARD_VIEW’.
The type under the ‘Settings’ section has three options, two of which (in bold) can be used to set a user preference. Their names are pretty self-explanatory.
- Reset Preferences (remove all preferences for current user)
- Set to Item Value
- Set to Item Value if Not Null
2. Programmatically Using an API
APEX also provides and API which you can use to set User Preferences. In the below code snippet, we are setting the user preference ‘DASHBOARD_VIEW’ to the value ‘DETAILED’ for the currently logged in user.
Getting Preference Values
1. Declaratively Using Page Item Source
You can declare the source for a page item to be a User Preference (again no code). This means that when the page is rendered, the page item automatically picks up the value for the preference.
In our example, we need to initialize the item ‘P3_DASHBOARD_VIEW’ with the current value for the user preference ‘DASHBOARD_VIEW’.
2. Programmatically Using an API
APEX also provides and API which you can use to get the value for a user preference. In the below code snippet, we are getting the current value for user preference ‘DASHBOARD_VIEW’ for the currently logged in user.
Purging User Preferences
1. Declaratively Using a Page Process
With this option you can purge all current user preference entries for a particular user and APEX Application. When the below page process runs, it will purge all user preferences for the current user and APEX application.
2. Via Workspace Administration
As a workspace administrator, you can view and purge user preferences for the currently logged in user or a specified user. You can access these options using the following navigation from Workspace Administration: Manage Service > Session State > Manage Preferences
Conclusion
Here is the link to the APEX 19.1 documentation on user preferences:
Author
Jon Dixon. Co-Founder JMJ Cloud