Best Practices for User Criteria
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2024 02:11 AM
Seeking expertise from this group!
We currently face challenges with user criteria, examples include:
1. A working user criteria suddenly cease to work after an upgrade
2. Legacy user criteria that does not work (we have over 400 legacy user criteria used across 3000 articles)
We have these user criteria for a HR knowledge base that supports users from over 50 countries. Would like to learn from you what are some best practices in using user criteria? What are some routine housekeeping/ regression testing processes put in place after upgrades/patches to ensure things don't break?
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2024 08:43 AM
Hey @Jayne Loh
See the attached document. It outlines some best practices and debugging methods. The most effective I've found is the User Criteria Diagnostics, but take a look since there's a lot of good information here.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2024 12:13 PM
@Jayne Loh In most of the cases User criteria related issues can be addressed via cache.do. You can also take helpf from this support article https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0790108 to take some help on addressing user criteria issues. As a last resort, you can use User Criteria Diagnostics to evaluate the user criteria.
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2024 12:18 PM
Hi @Jayne Loh ,
Best practices for using a script in user criteria
In case it is inevitable to use a script in user criteria, you can follow these best practices:
- The global object user_id points to the logged-in user. Use user_id in the script to get values for the logged-in user instead of performing a query or getting the corresponding values from the session.
- Do not use scoped APIs in scripts since they can fail as they are accessed from a different scope.If scoping is required, define a script includes in the required scope and call the script includes from the user criteria script. This practice is not recommended. Use only when it is inevitable for the business.
- If you have a script that can impact performance, for example, GlideRecord queries, then use gs.putClientData(name,value) to store result as a name value pair in the session. You can later in the session retrieve this data using gs.getClientData(name). The result is then cached at the session level for a user.
https://www.servicenow.com/community/now-platform-blog/a-deep-dive-to-user-criteria/ba-p/2281285
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks & Regards,
Sumanth Meda