changes in user profile of the logged in user not making the effective script validation immediately

siva krishna M2
Tera Guru

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?

 

 

  

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@siva krishna M2 

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.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

1 REPLY 1

Ankur Bawiskar
Tera Patron
Tera Patron

@siva krishna M2 

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.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader