- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2016 11:06 PM
Is there any way to evaluate whether a user meets a user criteria inside code (Such as a custom Script Include)?
I have found GlideappCatalogItem & GlideappCategory that can evaluate if something's visible, but they're java classes so I can't see what's under the hood. What I'd really love to be able to do is take a user_criteria & get back a true/false for the current user.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-18-2017 10:07 AM
You can return a list of user criteria records the the logged in user matches sever side using:
SNC.UserCriteriaLoader.getAllUserCriteria()
I created a script include to return the sys_id of a user criteria record to do the test:
getUserCritera_name(
"name_of_user_criteria_record")
I use this as a condition:
SNC.UserCriteriaLoader.getAllUserCriteria().indexOf(getUserCritera_name(
"Users at Corporate Locations"
)) > -1
I'm currently working on a script include to evaluate client side as well as against any user sys_id not just the logged in user.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2016 11:14 PM
Print logs by using gs.log() function inside the script and find out script is running perfectly or not.
Thanks,
Mihir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2016 11:21 PM
I'm not sure you've understood my question at all... I'm not asking to debug my script. I'm asking if a function within ServiceNOW for evaluating User Criteria (which I presume exists as the platform itself can evaluate it) is accessible to developers on the platform.
Logging won't help me with that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2016 11:56 PM
Hi Tim,
I had a similar question regarding user criteria about a week ago but haven't received any replies.. If I get a response, I'll be sure to update this thread.
Thanks,
Aric
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-18-2017 10:07 AM
You can return a list of user criteria records the the logged in user matches sever side using:
SNC.UserCriteriaLoader.getAllUserCriteria()
I created a script include to return the sys_id of a user criteria record to do the test:
getUserCritera_name(
"name_of_user_criteria_record")
I use this as a condition:
SNC.UserCriteriaLoader.getAllUserCriteria().indexOf(getUserCritera_name(
"Users at Corporate Locations"
)) > -1
I'm currently working on a script include to evaluate client side as well as against any user sys_id not just the logged in user.