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:23 AM
Yes Anurag, contact is the child table of User table.
Thanks,
Sam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2024 05:32 AM - edited 10-25-2024 05:32 AM
Can you show the user record where name is this
names == "ABC, XYZ")
Why are you checking name when you can just check the sys_id for a couple of names
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2024 05:36 AM
I checked with sys_id/s as well. but no luck😑
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2024 06:28 AM - edited 10-25-2024 06:29 AM
The name that you care comparing it to, 'ABC, XYZ', i understand it is an example you have given here, but to test can you hardcode it to a particular value and test to be sure.
Maybe remove that condition completely to see if the glide record is comin i the if con.next() block
Something like
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();
answer = true;
}
else{
answer = false;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2024 01:08 AM
Yes for particular business line it is working.
If I am giving below condition, its working as expected.
if (names == "ABC"){
answer= true
}
..............
Thanks,
Sam