User criteria is not working for Knowledge bases
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2024 02:05 AM
Hi all,
I have a requirement to show knowledge bases based on the Business Line.
Business line(List collector - referencing to Business Line table) is in Contact table(customer_contact).
I have created a User criteria and added in the Can read tab of Knowledge base.
My script is
var userss = user_id;
var con = new GlideRecord('customer_contact');
con.addEncodedQuery('accountISNOTEMPTY');
con.addQuery('sys_id', userss);
con.query();
if (con.next()) {
var names = con.u_bl_contact.getDisplayValue();
if ((names == "ABC, XYZ") || (names == "XYZ, ABX")) {
answer = true;
} else {
answer = false;
}
}
In the background script I am getting the true /false values.
But when I added it in the User criteria it is not working.
Please let me know what I am doing wrong.
- Labels:
-
Knowledge Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2024 05:05 AM
Hi @Kieran Anson ,
Yes everything is in Global scope.
Thanks,
Sam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2024 05:26 AM
I tried with sys_ids as well. still its not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2024 04:54 AM
Hi,
Problem is in this line
con.addQuery('sys_id', userss);
userss is sys_id of the logged in user and your GlideRecord is querying customer_contact table so it will have a sys_id of that table and not user record.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2024 05:04 AM
Hi @Anurag Tripathi ,
I am creating user criteria for Contacts that's why I glide the Contact table.
Thanks,
Sam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2024 05:09 AM
Im not familiar with that table, does the sys_id of a record on that table is the sys_id of user record?