Previous Next JavaScript must be enabled to correctly display this content

## 2.12 Managing User Preferences

Developers can use preferences to store values for a specific user across distinct sessions. Once set, these preferences can be removed programmatically or manually. Administrators can set user preferences by creating a page process, by the calculation of a preference Item Source Value, or programmatically by using a PL/SQL API.

- Setting User Preferences
  Developers can set user preferences within an application by creating a page process, creating a preference item, or programmatically using a PL/SQL API.
- Viewing Preferences by User
  View user preferences by user on the Preferences by User page.
- Viewing Current User Preferences
  View current user preferences.
- Purging Preferences for a Specific User
  Purge preferences for a specific user on the Purge Preferences page.
- Purging Preferences for the Current User
  Purge preferences for the current user on the Current User Preferences page.
- Removing User Preferences Programmatically
  Remove user preferences programmatically using a PL/SQL API.
- Resetting User Preferences Using a Page Process
  Reset user preferences by creating a page process.

Parent topic: Workspace and Application Administration

### 2.12.1 Setting User Preferences

Developers can set user preferences within an application by creating a page process, creating a preference item, or programmatically using a PL/SQL API.

- Setting User Preferences by Creating a Page Process
  Set user preference values by creating a page process.
- Setting the Source of an Item Based on a User Preference
  Set the source of an item based on a user preference by defining the item source type as Preference.
- Setting User Preferences Programmatically
  Set or reference user preferences programmatically using a PL/SQL API.

Parent topic: Managing User Preferences

#### 2.12.1.1 Setting User Preferences by Creating a Page Process

Set user preference values by creating a page process.

To set user preference values by creating a page process:

1. View the page in Page Designer and click the Processing tab.
2. Under Processes, right-click and select Create Process.
   Process attributes display in the Property Editor.
3. Under Identification:
   1. Name - Enter the name of the process.
   1. Type - Select User Preferences.
4. Under Settings, Type - Select Reset Preferences (remove all preferences for current user).
5. Under Execution Options:
   1. Sequence - Specify the sequence for this component. The sequence determines the order of execution.
   2. Point - Select the point at which the process executes.
6. Review and complete any additional attributes.

   Tip:

   To learn more about an attribute, select the attribute in the Property Editor and click the Help tab in the center pane.

7. Click Save.

See Also:

Creating Page Processes in Oracle APEX App Builder User’s Guide

Parent topic: Setting User Preferences

#### 2.12.1.2 Setting the Source of an Item Based on a User Preference

Set the source of an item based on a user preference by defining the item source type as Preference.

To define the source of item based on a user preference:

1. View the page in Page Designer.
2. Click the Rendering tab.
3. Locate the region to contain the item, right-click and select Create Page Item.
   Item attributes display in the Property Editor.

   Note:

   To learn more about an attribute, select the attribute and click the Help tab in the central pane.

4. Under Identification:
   1. Name - Enter a name of the item.
   1. Type - Select Hidden.
5. Under Settings, Value Protected - Specify whether the item is protected, preventing the value from being manipulated when the page is posted. Select Yes.
6. Under Layout:
   1. Sequence - Enter the display sequence for this item. The sequence and other layout settings determine where the item displays in relation to other items within the region.
   1. Region - Select the region in which the item displays. All items should be specified in a region.
7. Under Source:
   1. Type - Select the source type the value of this item is based on.
   2. Used - Select which value takes precedence (that is, the value from session state or the item source value).
8. Under Default, Type - Select a default value type for this item.
9. Click Save.

Parent topic: Setting User Preferences

#### 2.12.1.3 Setting User Preferences Programmatically

Set or reference user preferences programmatically using a PL/SQL API.

User-level caching is available programmatically. You can use the `SET_PREFERENCE` procedure to set a user level preference called `NAMED_PREFERENCE`. For example:

    APEX_UTIL.SET_PREFERENCE(
     p_preference=>'NAMED_PREFERENCE',
     p_value =>:ITEM_NAME);

You can reference the value of a user preference using the function `GET_PREFERENCE`. For example:

    NVL(APEX_UTIL.GET_PREFERENCE('NAMED_PREFERENCE'),15)

In the previous example, the preference would default to the value 15 if the preference contained no value.

See Also:

GET_PREFERENCE Function and SET_PREFERENCE Procedure in Oracle APEX API Reference

Parent topic: Setting User Preferences

### 2.12.2 Viewing Preferences by User

View user preferences by user on the Preferences by User page.

To view the preferences by user:

1. Navigate to the Workspace Administration page:
   1. Sign in to APEX.
   2. Select the Administration menu and then Administration.

   The Workspace Administration home page appears.

2. On the Administration page, click Manage Service.
3. Under Manage Meta Data, click Session State.
4. Click Preferences by User.

   The Preferences by User page appears.

5. You can customize the appearance of the page using the Search bar at the top of the page.

Parent topic: Managing User Preferences

### 2.12.3 Viewing Current User Preferences

View current user preferences.

To view current user preferences:

1. Navigate to the Workspace Administration page:
   1. Sign in to APEX.
   2. Select the Administration menu and then Administration.

   The Workspace Administration home page appears.

2. On the Administration page, click Manage Service.
3. Under Manage Meta Data, click Session State.
4. Click Current User Preferences.

   The Current user Preferences page appears.

   You can customize the appearance of the page using the Search bar at the top of the page.

Parent topic: Managing User Preferences

### 2.12.4 Purging Preferences for a Specific User

Purge preferences for a specific user on the Purge Preferences page.

To purge preferences for a specific user:

1. Navigate to the Workspace Administration page:
   1. Sign in to APEX.
   2. Select the Administration menu and then Administration.

   The Workspace Administration home page appears.

2. On the Administration page, click Manage Service.
3. Under Manage Meta Data, click Session State.
4. Click Purge Preferences by User.
5. On the Purge Preferences page, select a specific user and click Report.

   A report appears at the bottom of the page.

6. To purge the displayed user preferences, click Purge User Preferences.

Parent topic: Managing User Preferences

### 2.12.5 Purging Preferences for the Current User

Purge preferences for the current user on the Current User Preferences page.

To purge preferences for the current user:

1. Navigate to the Workspace Administration page:
   1. Sign in to APEX.
   2. Select the Administration menu and then Administration.

   The Workspace Administration home page appears.

2. On the Administration page, click Manage Service.
3. Under Manage Meta Data, click Session State.
4. Click Purge Preferences for Current User.
5. Click View Preferences or Reset Preferences.
6. If you select View Preferences, the Current User Preferences page appears. To reset the user preferences, click Reset.

Parent topic: Managing User Preferences

### 2.12.6 Removing User Preferences Programmatically

Remove user preferences programmatically using a PL/SQL API.

To remove user preferences programmatically, use the `REMOVE_PREFERENCE` procedure to remove a user level preference called `NAMED_PREFERENCE`. For example:

    APEX_UTIL.REMOVE_PREFERENCE(
    p_preference=>'NAMED_PREFERENCE');

See Also:

REMOVE_PREFERENCE in Oracle APEX API Reference

Parent topic: Managing User Preferences

### 2.12.7 Resetting User Preferences Using a Page Process

Reset user preferences by creating a page process.

To reset user preferences using a page process:

1. View the page in Page Designer and click the Processing tab.
2. Under Processes, right-click and select Create Process.
   Process attributes display in the Property Editor.

   Tip:

   To learn more about an attribute, select the attribute in the Property Editor and click the Help tab in the center pane.

3. Under Identification:
   1. Name - Enter the name of the process.
   1. Type - Select Clear Session State.
4. Under Settings, Type - Select Clear Current Session.
5. Under Execution Options:
   1. Sequence - Specify the sequence for this component. The sequence determines the order of execution.
   2. Point - Select the point at which the process executes.
   3. Run Process - Select the frequency at which the process executes.
6. Review and complete any additional attributes.
7. Click Save.

See Also:

Creating Page Processes in Oracle APEX App Builder User’s Guide

Parent topic: Managing User Preferences