getAllUserCriteria - Deprecated

Khanna Ji
Tera Guru

getAllUserCriteria is deprecated. Does anybody has found a replacement method for this?

 

UserCriteriaLoader - API to Evaluate User Criteria

6 REPLIES 6

Robbie
Kilo Patron
Kilo Patron

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) - 

https://www.servicenow.com/community/upgrades-and-patching-forum/major-performance-issues-after-wash...

 

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

Brenda Williams
Tera Contributor

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)

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);

 

 

 

Robbie
Kilo Patron
Kilo Patron

@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