Validate user against a user criteria
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-28-2016 03:15 AM
Have you every wanted to take advantage of user criterias in other places of servicenow than is available OOTB? - eg. to control who can access an element in the CMS or a content of a widget in Service Portal?
Here on Share is a script include which allows exactly that.
Use by calling:
var ucu = new UserCriteriaUtil('USER CRITERIA SYS_ID');
var answer = ucu.check();
It will return true if the current user complies to the user criteria.
All condition types (including scripts) are supported - except the feature where you can add custom fields (Extending User Criteria)
Credits go out to my old colleague jespersandberg-how who coded the function originally based on an idea of mine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-18-2017 07:50 AM
Hi Lars
Do I need to do anything other than specify the sys id of the user criteria I want to be applied to the widget.
I've installed the script and added the sys id of the user criteria i want applied to
var ucu = new UserCriteriaUtil('USER CRITERIA SYS_ID');
var answer = ucu.check();
I don't get any errors but its not having any effect so i'm wondering if I'm missing a step. I'm not good enough at scripting to read the code of the script include to understand if I need to do anything else.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2020 10:16 AM
Hi Lars,
I just wanted to say thank you for posting this and developing the script include 4 years ago!
I am using this to check that 2 user criteria rules are met and it is saving me having to create multiple new user criteria records to handle this scenario. We are doing an initial pilot for something on the Service Portal and as it expands out to multiple batches of users over the coming months it means I just have a single user criteria record to update to control this. So it will save time in the future and reduce the risk of human error having to amend the logic in multiple places.
Good job and thanks for your efforts in developing/posting this 🙂
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2020 01:51 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-19-2021 06:18 PM
Do you know how this can be used if I want to see on incident form if the caller is part of a user criteria or not? and based off of that an alert/message would display on the form. I've been trying to use what you provided above but no luck so far.