- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-21-2014 12:49 PM
I have a requirement for a UI action to toggle back and forth between views of the Incident form. It's easy enough to redirect the user to a particular view, but the user interface is not remembering the setting as the user's preferred view. So I programmatically insert records into the user preference table, but the system is ignoring these preferences, until I logout and log back in. Are the user preferences also being maintained in the session data somehow?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-22-2014 05:25 AM
Syntax for client-side scripts is almost the same but without the gs,getUser() part:
setPreference('user_preference_name', 'user_preference_value');
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-22-2014 05:10 AM
Are you inserting/updating preferences using a usual GlideRecord query or using setPreference method? I think the preferences are not applied if changed using a GlideRecord query.
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-22-2014 10:21 AM
Thanks Slava, I thought you were really onto something! But I tried the following with no effect:
gs.getUser.setPreference('incident.view','tier_3');
gs.getUser.setPreference('incident_list.view','tier_3');
I couldn't find the setPreference() method documented on the wiki, except for how it applies to the UI Page object. Are you aware of any documentation for it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-22-2014 11:01 AM
In your examples, there are no brackets after getUser. Can it be the reason why the method is not working?
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-22-2014 02:24 PM
No, that was a typo in my response. It was actually:
current.update(); | |
gs.getUser().setPreference('incident.view','tier_3'); | |
gs.getuser().setPreference('incident_list.view','tier_3'); | |
action.setRedirectURL('incident.do?sys_id=' + current.sys_id + '&sysparm_view=tier_3'); |