getAllUserCriteria - Deprecated
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2024 12:22 AM - edited 12-05-2024 12:23 AM
getAllUserCriteria is deprecated. Does anybody has found a replacement method for this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2024 01:39 AM
Hi @Khanna Ji,
It seems you're not alone, apparently the advice was to update from SNC.UserCriteriaLoader.getAllUserCriteria() to sn_uc.UserCriteriaLoader.getAllUserCriteria() - however it seems Washington upgrade onwards this may too be deprecated.
Reach out to @Brenda Williams on the below link who also experienced and shared this issue (Kudos) -
You may also need to check and log a ticket with ServiceNow Support as well seeing as this seems to be an undocumented API.
To help others (and for me to gain recognition for my efforts), please mark this response correct by clicking on Accept as Solution and/or Kudos.
Thanks, Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2024 10:19 AM
Thanks Robbie! I updated on my post but will update here as well it required us to Remove or comment out new sn_uc.UserCriteriaLoader.getAllUserCriteria() everywhere we had used it throughout or portal/catalog. Rewrite meetsCriteria() to use $sp.canReadRecord(now_GR) or $sp.canReadRecord(table, sys_id)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2024 06:24 AM
meetsCriteria() - Where is it documented?
I am using below
//var SNCUserCriteria = new SNC.UserCriteriaLoader();
//var userCriterias = SNCUserCriteria.getAllUserCriteria();
//gs.info('userCriterias - ' + userCriterias);
// Manually load user criteria for the logged-in user
var userCriterias = [];
var userCriteriaGr = new GlideRecord('user_criteria');
userCriteriaGr.addQuery('active', true); // Select active records
userCriteriaGr.query();
while (userCriteriaGr.next()) {
userCriterias.push(userCriteriaGr.getUniqueValue());
}
var matchingCriterias = sn_uc.UserCriteriaLoader.getMatchingCriteria(gs.getUserID(), userCriterias);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2024 01:26 AM
@Khanna Ji - There you go, straight from @Brenda Williams below - Kudos.
"Remove or comment out new sn_uc.UserCriteriaLoader.getAllUserCriteria() everywhere we had used it throughout or portal/catalog. Rewrite meetsCriteria() to use $sp.canReadRecord(now_GR) or $sp.canReadRecord(table, sys_id)"
To help others (and for me to gain recognition for my efforts), please mark this response correct by clicking on Accept as Solution and/or Kudos.
Thanks, Robbie