- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2024 10:13 AM - edited 01-12-2024 12:55 PM
Hello,
User A has the Admin role who can see all the knowledge articles and catalog item in search field on Service portal. User B is end user and is not able to get the same search results as User A for instance User A gets 8010 results and for the same thing User B gets 586 results when searching for Ka's. And for catalog items User A gets 422 and User B gets 351 results. I have also tried granting Admin role to User B it is still not working as it is working for User A. Here AI search is enabled and these results are through AI search. I have also tried to deactivating knowledge ACL's it is still the same. Enclosed below with the screenshots. Please advise.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2024 02:25 PM - edited 01-17-2024 03:32 PM
I figured this out. Every Knowledge base has related list that has an option "Can read" and every catalog item has a related list that has an option "Available for" in this we need to add user criteria based on our requirement.
First create a user criteria, add specific users/groups/roles etc or any one of them based on requirement.
Now add that user criteria to all the Knowledge bases related list "Can read" option and all Catalog items related list "Available for" that are to be displayed. After adding it the search results must be same for all the users. If the Ka's and CI's you want to add are more than 20-50 it is better to use scripts - background.
Hope the below script helps.
//To add a user criteria for multiple articles at one time.
var userCriteriaSysId = 'sys_id of the user_criteria created';
// Query for all active knowledge bases
var kbs = new GlideRecord('kb_knowledge_base');
kbs.addQuery('active', true);
kbs.query();
// Iterate through the knowledge bases and add the user criteria
while (kbs.next()) {
try {
// Create a new M2M record linking the knowledge base to the user criteria
var m2mRecord = new GlideRecord('kb_uc_can_read_mtom');
m2mRecord.initialize();
m2mRecord.setValue('kb_knowledge_base', kbs.sys_id);
m2mRecord.setValue('user_criteria', userCriteriaSysId);
m2mRecord.insert();
gs.log("Executing KB script");
} catch (error) {
// Handle any errors that may occur during insertion
gs.error('Error adding user criteria to knowledge base: ' + kbs.sys_id + ' - ' + error);
}
}
Same thing can be done for catalog items
var userCriteriaSysId = 'sys_id of user criteria';
// Query for all active Catalog items
var cis = new GlideRecord('sc_cat_item');
cis.addQuery('active', true);
cis.query();
// Iterate through the Catalog items and add user criteria
while (cis.next()) {
try {
// Create a new M2M record linking the catalog item with the user criteria
var m2mRecord = new GlideRecord('sc_cat_item_user_criteria_mtom');
m2mRecord.initialize();
m2mRecord.setValue('sc_cat_item', cis.sys_id);
m2mRecord.setValue('user_criteria', userCriteriaSysId);
m2mRecord.insert();
gs.log("Executing KB script");
} catch (error) {
// Handle any errors that may occur during insertion
gs.error('Error adding user criteria to catalog items: ' + cis.sys_id + ' - ' + error);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2024 10:24 AM
Hello Abeer-khan,
Some possible reasons I can think of that may be relevant to you:
1. Do you work with data segregation and is user A perhaps seeing more data based on custom logic set up on your instance? (e.g. company, department, country, etc.)
2. Are some of these catalog items and knowledge articles, built in a different application scope?
Certain applications have dedicated roles for security reasons and if for example user A has additional roles such as HR_admin, he may see see more data.
3. Is there any custom integration set up between instances? Perhaps data from another instance is being shown, and user A has access to this instance data.
If not, I would recommend to isolate one of these catalog items / knowledge articles and try and determine what could be different in terms of visibility.
If my post helped you, please click the accept solution button and hit the thumbs up! Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2024 02:25 PM - edited 01-17-2024 03:32 PM
I figured this out. Every Knowledge base has related list that has an option "Can read" and every catalog item has a related list that has an option "Available for" in this we need to add user criteria based on our requirement.
First create a user criteria, add specific users/groups/roles etc or any one of them based on requirement.
Now add that user criteria to all the Knowledge bases related list "Can read" option and all Catalog items related list "Available for" that are to be displayed. After adding it the search results must be same for all the users. If the Ka's and CI's you want to add are more than 20-50 it is better to use scripts - background.
Hope the below script helps.
//To add a user criteria for multiple articles at one time.
var userCriteriaSysId = 'sys_id of the user_criteria created';
// Query for all active knowledge bases
var kbs = new GlideRecord('kb_knowledge_base');
kbs.addQuery('active', true);
kbs.query();
// Iterate through the knowledge bases and add the user criteria
while (kbs.next()) {
try {
// Create a new M2M record linking the knowledge base to the user criteria
var m2mRecord = new GlideRecord('kb_uc_can_read_mtom');
m2mRecord.initialize();
m2mRecord.setValue('kb_knowledge_base', kbs.sys_id);
m2mRecord.setValue('user_criteria', userCriteriaSysId);
m2mRecord.insert();
gs.log("Executing KB script");
} catch (error) {
// Handle any errors that may occur during insertion
gs.error('Error adding user criteria to knowledge base: ' + kbs.sys_id + ' - ' + error);
}
}
Same thing can be done for catalog items
var userCriteriaSysId = 'sys_id of user criteria';
// Query for all active Catalog items
var cis = new GlideRecord('sc_cat_item');
cis.addQuery('active', true);
cis.query();
// Iterate through the Catalog items and add user criteria
while (cis.next()) {
try {
// Create a new M2M record linking the catalog item with the user criteria
var m2mRecord = new GlideRecord('sc_cat_item_user_criteria_mtom');
m2mRecord.initialize();
m2mRecord.setValue('sc_cat_item', cis.sys_id);
m2mRecord.setValue('user_criteria', userCriteriaSysId);
m2mRecord.insert();
gs.log("Executing KB script");
} catch (error) {
// Handle any errors that may occur during insertion
gs.error('Error adding user criteria to catalog items: ' + cis.sys_id + ' - ' + error);
}
}