is there to clear user criteria cache without logging out in through script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2020 03:32 AM
is there to clear user criteria cache without logging out in through script. If we have user criteria based on location it get effective if logging again
- Labels:
-
Multiple Versions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2020 03:39 AM
Hi,
Do not use gs.getUser() or other session APIs since they cause conflict when used in diagnostic tools.
Use the pre-defined user_id variable available in the script to get the user id of the user being used to evaluate the script.
Try this
gs.cacheflush("criteria_cache");
reference: Apply effects of User Criteria without the need to log out and back in – ServiceNow
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2020 03:50 AM
could you please elaborate user_id variable if possible give me example
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2020 04:03 AM
Hi Manish,
it is out of the box variable available in user criteria script which would give you logged in user's sys_id
You can use that to get the sys_id and then query user table and check whatever you wish to
Example: don't use gs.getUser().getLocation() to get the location but query sys_user table with user_id and then get the location
best practice mentioned here
user_id variable usage for user criteria
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2020 05:15 AM
tried it didn't worked