Match some user against some user criteria record (server side)

A Elbarbary
Giga Guru

Based on the official wiki page, a User Criteria record may contain a specific set of users, groups, roles, departments ....

My question is, do I have to do manual checking for the user against user criteria, something like:

  1.       check if the user exists in user criteria users list
  2.       then if the previous test failed, check if the user role exists in user criteria roles list
  3.       then if the previous test failed, check for departments .... and so on

Or is there something out of the box in snow that carries out these checks for me? I guess there should be some way but I can't find any thing relevant in the official wiki or docs

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

One of my colleagues passed this along a few weeks ago. It's worth a try.



SNC.UserCriteriaLoader.getAllUserCriteria()



Returns an array of sys_ids of the user criteria available to you. (applies to user's current login session.)


View solution in original post

5 REPLIES 5

johnmark
ServiceNow Employee
ServiceNow Employee

UserCriteriaLoader.getAllUserCriteria() method is a deprecated method and we advice using userMatches() instead.

☞ Please refer to this article below, which explains on this in detailed.
https://www.servicenow.com/community/now-platform-blog/a-deep-dive-to-user-criteria/ba-p/2281285

 

Below are additional Knowledge articles which discusses Semaphore Exhaustion caused by the getAllUserCriteria function being called in widgets:

 

Semaphore Exhaustion is caused due to the getAllUserCriteria function getting called in widgets

Semaphores keep getting stuck and cause slow performance due to UserCriteriaLoader.getAllUserCriteri...