HRSD

P1234
Tera Contributor

 

Knowledge author i want to hide all the non-HR can & cannot read criteria from the HR knowledge bases(HR all employees & HR-Agents).

 

Below process i create but not working as per the above requirement. any one idea help me

 

Go to Knowledge > Administration > Knowledge Bases.

Open the HR knowledge base.

Under Can Read / Cannot Read, ensure only relevant HR criteria are listed.

Remove any user criteria not related to HR.


2.Create Separate HR-Specific User Criteria
Create user criteria that target only HR users:

Go to Knowledge > Administration > User Criteria.

Create user criteria like HR Only, with conditions based on roles (hasRole: hr_user or equivalent).

Use these for Can Read / Cannot Read settings.

 

3.Restrict Author Visibility in Knowledge Author UI
If you're using the Knowledge Author customize the visibility of criteria:

Option A: Use ACLs
Create Access Control Rules (sys_user_criteria) that restrict visibility of user criteria based on roles (e.g., only HR authors can see HR-related criteria).

Client Scripts
If authors use a form to select criteria:

Client Script on the Knowledge Article form to hide non-HR criteria when the knowledge base is HR-related.

if (g_form.getValue('kb_knowledge_base') == 'HR - All Employees' || g_form.getValue('kb_knowledge_base') == 'HR - Agents') {
g_form.setDisplay('non_hr_user_criteria_field', false);

3 REPLIES 3

Abbas_5
Tera Sage
Tera Sage

Hello @P1234 ,

 

To hide non-HR "Can Read" and "Cannot Read" criteria from HR knowledge bases in ServiceNow, you can use a combination of user criteria, access control rules, and potentially client scripts.  First, define HR-specific user criteria, then use Access Control Rules to restrict their visibility, and if necessary, utilise client scripts on the Knowledge Article form to hide non-HR criteria.
 
Please refer to the below steps:
 
1. Define HR-Specific User Criteria:
  • Create new criteria:
    Go to Knowledge > Administration > User Criteria and create new criteria that specifically target HR users (e.g., HR Only, HR Agents, etc.).
     
  • Define conditions:
    Based on roles or other relevant attributes, define the conditions for these criteria (e.g., hasRole: hr_user). 
     
  • Mark as HR criteria:
    If using the "HR Criteria" field, ensure these criteria are marked as "HR Criteria". 
     
2. Restrict Visibility with Access Control Rules:
  • Create ACLs:
    Go to System Administration > Access Control and create Access Control Rules for the sys_user_criteria table.
  • Restrict visibility:
    Set up ACLs that allow only users with HR roles (e.g., hr_adminhr_user) to see the HR-specific user criteria, while hiding them from others.
     
3. Hide Non-HR Criteria on the Knowledge Article Form (Optional):
  • Use a client script:
    On the Knowledge Article form, add a client script to hide non-HR user criteria when the knowledge base is HR-related.
  • Implement script logic:
    This script will check the selected knowledge base and, if it's an HR knowledge base, hide the non-HR criteria from the "Can Read" and "Cannot Read" fields.
     
Example Client Script (Simplified):
 
function hideNonHRCriteria() {  if (g_form.getValue('kb_knowledge_base') == '<HR_KNOWLEDGE_BASE_SYS_ID>') { // Replace with your HR KB SYS_ID    g_form.setDisplay('user_criteria', false); // Assuming 'user_criteria' is the field for Can Read/Cannot Read  }} 

If it is helpful, please mark it as helpful and accept the correct solution by refer to this solution it will helpful to them.

Thanks & Regards,
Abbas Shaik

P1234
Tera Contributor

Hi Abbas,

 

Can you please attach the Screenshots for reference.

 

New to learn HRSD & ServiceNow

Hello @P1234 ,

 

Which screenshot are you talking about?

 

Regards,

Abbas