The Now Platform® Washington DC release is live. Watch now!

Help
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

A Elbarbary
Tera Expert

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
ServiceNow Employee
ServiceNow Employee

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

4 REPLIES 4

Chuck Tomasi
ServiceNow Employee
ServiceNow Employee

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.)


thanks chuck, it works as expected


Hi Chuck,

Based on the question, this API works but we are evaluating all the UCs, whereas we only want to evaluate only 1.

So I feel we are unnecessarily evaluating all UC, so if I want to use this script in run-time it may take quite some time. Whereas we want only 1 UC to be evaluated.

Regards,

Swarnadeep Nandy

Hi Swarnadeep,

Did you find any solution on this?