- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2016 07:27 AM
We would like to test against User Criteria definitions in the condition of a business rule, UI action, client script, etc.
Is there a way to script to test against User Criteria definitions and return true or false?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2016 07:32 AM
Hi Robert,
There is a class/method to use to tell you which criteria apply. I have not yet figured out a way to evaluate each of those. Do some experimenting - i'm curious to know more.
SNC.UserCriteriaLoader.getAllUserCriteria()
Returns an array of sys_ids of the user criteria available to you. (applies to user's current login session.)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2016 07:32 AM
Hi Robert,
There is a class/method to use to tell you which criteria apply. I have not yet figured out a way to evaluate each of those. Do some experimenting - i'm curious to know more.
SNC.UserCriteriaLoader.getAllUserCriteria()
Returns an array of sys_ids of the user criteria available to you. (applies to user's current login session.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2016 08:34 AM
I knew I could count on you Chuck.
With this I would create a script include that would return the sys_id of a User Criteria record that I want to test against. Then see if that sys_id is contained in the array returned by SNC.UserCriteriaLoader.getAllUserCriteria().
Like:
SNC.UserCriteriaLoader.getAllUserCriteria().indexOf(getUserCriteraFromName("Users at Corporate Locations")) > -1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2017 01:16 PM
I had one more question on this and I hope you can help me. Below will allow me to script against if the logged in user meets a certain User Criteria but what if I want to see if a user is a reference field meets the criteria?
SNC.UserCriteriaLoader.getAllUserCriteria().indexOf(getUserCritera_name("Users at Corporate Locations")) > -1
getUserCritera_name("Users at Corporate Locations") returns the sys_id of the User Criteria record

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-26-2017 07:31 AM
Hi Robert,
I'm not clear what your objective is. Can you clarify this?
what if I want to see if a user is a reference field meets the criteria