is there to clear user criteria cache without logging out in through script

manish64
Giga Guru

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

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

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

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

could you please elaborate user_id variable if possible give me example

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

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

manish64
Giga Guru

tried it didn't worked