- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2024 10:19 PM - edited 01-08-2024 10:22 PM
changes in user profile of the logged in user not making the effective script validation immediately mainly on server side scripts but working after logout and relogin to the instance.
There is user criteria defined for the knowledge article which is checking logged in user custom field value(ex: article access field is on user record). We wrote below script in user criteria
var tr = new GlideRecord('sys_user');
tr.addQuery('sys_id',gs.getUserID())
tr.query()
if(tr.next())
{
if(tr.article_access ==true)// to provide access to knowledge article if article access is true
{
return true;
}
else
{
return false;
}
Initially the article access field is false and user is unable to access the knowledge article. we made the field article access as "true" for the user using background script. Still user is unable to access the article but it is working when user logout and login again to the instance. we observed this behavior when we grant few roles to the user as well
why user has to logout and login again to the instance to make the scripts, roles added to user to become effective. how ServiceNow is storing user fields and at what intervals it is checking those fields in user criteria scripts or other server side scripts?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2024 10:30 PM
you need to logout and login or clear instance cache using cache.do
How to overcome that is mentioned in below link
Catalog Item User Criteria evaluating only once from the Service Portal
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2024 10:30 PM
you need to logout and login or clear instance cache using cache.do
How to overcome that is mentioned in below link
Catalog Item User Criteria evaluating only once from the Service Portal
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader