- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on ‎02-12-2020 09:09 AM
After a lot of debugging and numerous searches on the Community, I wanted to post what seems to be the only working solution I've been able to come up with for using User Criteria to limit something via a Condition, such as a Header Menu via the Service Portal.
SNC.UserCriteriaLoader.getAllUserCriteria().toString().includes("sys_id_of_the_User_Criteria_record")
Note that you don't need the User Criteria for the Service Portal plugin for this to work.
- 2,508 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hey
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Happy to help, suladance. 😃
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Exactly what I was looking for 🙂
Thanks, Shane!
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
do you know how it works with in combination of the HR criteria?
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Thanks Shane! Exactly what I was looking for, will save me updating user criteria in multiple areas
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Thank you so much!
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
If anyone has this problem and the provided solution is not working, try the following:
sn_uc.UserCriteriaLoader.getAllUserCriteria(gs.getUserID()).toString().includes("sys_id_of_user_criteria")
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Thank you so much @tobbasp - your solution works for me!!
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
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