# Saving user preferencies on APEX

Many apps offer options for users to personalize the appearance and functionality of the app and developers commonly utilize tables to store these customizations.  
  
One of the many features that APEX provides is the APEX\_UTIL package, which includes a variety of useful functions and procedures to enhance application development. Among these functions, APEX\_UTIL.SET\_PREFERENCE stands out as a convenient tool for saving application preferences efficiently without the need to create tables or new columns.  
  
To save a user preference, we have the choice to execute the following code either through PL/SQL, utilizing a page process known as User Preferences or a page computation.  

In the example below, we will save the user's preferred choice for viewing a calendar.

```sql
BEGIN
    APEX_UTIL.SET_PREFERENCE(        
        p_preference => 'CALENDAR_VIEW',
        p_value      => :P1_CALENDAR_VIEW,      
        p_user       => :APP_USER); 
END;
```

We also have the option to use a ***User Preference*** page process after submitting on the processing point to save that.  

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1685478112892/ccdd92b5-0723-436a-9c11-be45228a54f2.png align="center")

To retrieve the saved preference value and use it for customizing the app when users visit the calendar page, we can also utilize either PL/SQL, a page process or a computation.

```sql
BEGIN
:P1_CALENDAR_VIEW := APEX_UTIL.GET_PREFERENCE(      
                       p_preference => 'CALENDAR_VIEW',
                       p_user       => :APP_USER
                     );
END;
```

If we want to use a computation we can use as follows.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1685479241828/fbcee6a3-0fff-4d92-ba28-aa070d7650e4.png align="center")

If we decide to eliminate the functionality or no longer want to save or maintain the user preference within the given context we can just delete the preference  

```sql
BEGIN
    APEX_UTIL.REMOVE_PREFERENCE(
        p_preference => 'CALENDAR_VIEW',
        p_user       => :APP_USER);    
END;
```

If you are still using tables as a means to store customizations specific to individual users, it is highly recommended that you begin utilizing the user preferences feature. This feature offers a more efficient and streamlined approach to managing user-specific settings and preferences.
