User Criteria Scripts

jcmings
Mega Sage

Are user criteria AND based or OR based? If I set up a user criteria for both a Group and a Script, do both checks have to pass? Or is one sufficient?

1 ACCEPTED SOLUTION

Hi @JamesEcoStratus, I have just revisited this issue and I think your statement is actually incorrect. From my testing, the script overrides the other established criteria. In other words, if the script evaluates to true, the user criteria passes, regardless of the other criteria specified on the record. 

 

I have come to this conclusion by running my own tests and by viewing this Community post. I will note that in order to test user criteria, even if by using the User Criteria Diagnostics link in the backend, you must clear cache or logout in-between tests. I spent a few hours yesterday not knowing this (it isn't intuitive that running the diagnostics check as an admin would require a logout/cache refresh) driving myself crazy... hopefully this post can save someone else the trouble in the future.

 

View solution in original post

3 REPLIES 3

JamesEcoStratus
Mega Guru

Hi, based on my understanding of your question from the information you’ve provided, see my answer below.

 

In ServiceNow, user criteria are typically AND-based, meaning that all the specified conditions must be met for a user to be considered eligible. If you set up user criteria involving both a Group and a Script, both checks usually must pass for the user to meet the criteria.

 

Here's a simplified example to illustrate:

 

Let's say you have the following user criteria:

 

  1. Group Criteria: User must be a member of the "IT Support" group.
  2. Script Criteria: User must have a custom attribute "Is Manager" set to "True" in their user record.

 

If both criteria are specified, then a user must meet both conditions:

 

  • The user must be a member of the "IT Support" group.
  • The user must have the "Is Manager" attribute set to "True" in their user record.

If either of these conditions is not met, the user will not meet the criteria. This is the typical behavior in ServiceNow when you configure user criteria.

 

However, it's essential to keep in mind that the specific behavior may vary depending on your instance's configuration and any customizations that have been made. Always refer to the documentation or consult with your organization's ServiceNow administrators to ensure the behavior aligns with your instance's setup and requirements.

 

Good Luck!

 

James @Ecostratus

 

If I helped you with your question, then please hit the Thumb Icon and mark it as Helpful or Correct.

Hi @JamesEcoStratus, I have just revisited this issue and I think your statement is actually incorrect. From my testing, the script overrides the other established criteria. In other words, if the script evaluates to true, the user criteria passes, regardless of the other criteria specified on the record. 

 

I have come to this conclusion by running my own tests and by viewing this Community post. I will note that in order to test user criteria, even if by using the User Criteria Diagnostics link in the backend, you must clear cache or logout in-between tests. I spent a few hours yesterday not knowing this (it isn't intuitive that running the diagnostics check as an admin would require a logout/cache refresh) driving myself crazy... hopefully this post can save someone else the trouble in the future.

 

Hi @jcmings ,

 

Your observations and insights into ServiceNow user criteria are greatly appreciated. I think the discussion you've initiated brings to light the variability in how user criteria can behave in different ServiceNow instances.

 

In ServiceNow, user criteria are typically AND-based, as I initially mentioned, meaning that all specified conditions must be met for a user to be considered eligible. This provides a general understanding of how user criteria work and serves as a solid guideline for many instances.

 

On the other hand, your perspective suggests that, based on your testing, the script criteria can sometimes override other established criteria. This highlights the flexibility and customizability of ServiceNow, where behavior can vary depending on the specific setup and configurations in place.

Given this variability, your practical advice about clearing the cache or logging out between tests when using the User Criteria Diagnostics link is a significant contribution. This detail may not be immediately intuitive and could save administrators a lot of time and frustration when working with user criteria.

In summary, both perspectives presented here are valid, and the behavior of user criteria can indeed differ based on the specific instance's configuration. It's important to be aware of these nuances, perform testing in your specific environment, and consult with ServiceNow experts to ensure that user criteria align with your instance's requirements.

 

Thank you for the informative discussion and for sharing your insights to benefit the ServiceNow community.

 

Best regards,
@JamesEcostratus