logo

NJP

Enabling Real-Time Evaluation of User Criteria in ServiceNow

New article articles in ServiceNow Community · Apr 07, 2025 · article

If you’ve worked with User Criteria in ServiceNow—especially in scenarios involving dynamic access control—you might have noticed an odd behavior: User Criteria is only re-evaluated at login time, even if your criteria contains scripting logic. This can be problematic if the condition is expected to change during an active session, such as based on a user’s group membership, department, or other runtime data.

The Problem

By default, ServiceNow caches the User Criteria evaluation for performance reasons. This means that once a user logs in and the system evaluates their access, the result is stored. Any changes to conditions—whether in the user's data or in the scripted condition—will not be reflected until the next login.

This behavior can lead to access issues, especially in real-time applications like catalog visibility, knowledge base access, or workspace experiences.

✅ The Solution

To allow User Criteria to be evaluated on-demand and conditionally, you need to disable two specific platform caches.

Go to System Properties → All Properties and set the following properties:

glide.cache.disabled.USER_ITEMS_CACHE = true

glide.cache.disabled.criteria_cache = true

Once these properties are set to true, the system will no longer cache User Criteria results, allowing your script conditions to be evaluated in real-time.

⚠️ A Word of Caution

Disabling cache has a direct impact on performance. Every time the system needs to evaluate access (like loading a catalog item or knowledge article), it will run the User Criteria scripts again, which can be costly depending on how often and how complex your logic is.

🔧 Best Practices to Mitigate Performance Risks:

  • Keep your User Criteria scripts lightweight and optimized.
  • Avoid unnecessary GlideRecord queries.
  • Consider using async evaluations or separate background recalculation logic if your conditions are complex.
  • Regularly audit and clean up unused or redundant User Criteria records.

🏁 Final Thoughts

While disabling the User Criteria cache isn't the right solution for every use case, it can be a powerful tool for scenarios that require conditional access checks beyond user login. Just make sure to monitor performance and follow best practices when implementing this behavior.

View original source

https://www.servicenow.com/community/developer-articles/enabling-real-time-evaluation-of-user-criteria-in-servicenow/ta-p/3230727