Check if SNC.UserCriteriaLoader.getAllUserCriteria() works in server widget.

jacc_99
Giga Guru

Hi,

 

I need to check the next in all active kb categories:

1) Kb category has subcategories?

2) Kb category has kb articles related directly with this kb category?

3) User logged can view kb articles?

 

In point 3, I have this addQuery in kb_knowledge GlideRecord:

gr.addQuery('can_read_user_criteria', 'IN', SNC.UserCriteriaLoader.getAllUserCriteria()).addOrCondition('can_read_user_criteria', '');

 

With this add query can I check visibility of the user according to User Criteria the kb articles have?

 

Thanks in advance!

 

 

1 REPLY 1

johnmark
ServiceNow Employee
ServiceNow Employee

 

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

Semaphores keep getting stuck and cause slow performance due to UserCriteriaLoader.getAllUserCriteri...