setPreference Method

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2018 02:47 AM
Hi All,
Anyone can explain about setPreference method.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2018 03:57 AM
It's a serverside method and will insert or update a user preference in the sys_user_preference table.
Usage example:
gs.getUser().setPreference('name', 'value');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2018 04:54 AM
In addition to what Arnoud has method, there is setPreference method for GlideDialogWindow API
https://www.servicenowguru.com/system-ui/glidedialogwindow-advanced-popups-ui-pages/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2023 10:06 AM
The purpose of setPreference method is to save a user-specific setting in the User Preferences table. In server-side scripts, use the following syntax to set a preference for the current user:
gs.getUser().setPreference('user_preference_name', 'user_preference_value');
In client-side scripts, use this instead:
setPreference('user_preference_name', 'user_preference_value');
For more information about User Preferences, refer to this article from the product documentation.
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/