- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2020 03:15 AM
Hi,
What is the correct way to use the setPreference function to set a user preference in a scoped application?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2020 05:26 AM
I have found the solution to this, you have to use savePreference when in a scoped app.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2020 03:38 AM
Hello,
You can create script include and call that from scoped application.
Have look on this,
If answer is helpful please mark correct or helpful!
Thanks,
Pratiksha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2020 03:42 AM
I have tried this method and it doesn't seem to work.
I am attempted this in a virtual agent script, I'm not sure if that has any affect on setting user preference.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2020 04:21 AM
You can try this:
grUserPreference = new GlideRecord('sys_user_preference');
grUserPreference.addQuery('name',< your user preference >);
grUserPreference.query();
if( grUserPreference.next() ) {
grUserPreference.value = <your value>;
grUserPreference.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2020 05:26 AM
I have found the solution to this, you have to use savePreference when in a scoped app.