FIlter Configuration in Contextual Search
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2018 09:03 PM
Below is the code that i am using to filter the Knowledge Article based on Knowledge Base if the logged in user has a service_desk role, if not no filters.
if (gs.hasRole('service_desk')) {
query_table.addQuery('kb_knowledge_base','d23ea8020f39df04c1931b2be1050e21');
}
query_table.addActiveQuery();
return query_table.getEncodedQuery();
This is working but even if the user does not have the role the if conditions is returning true.
Has anybody configured Filter Configurations? Any ideas what could go wrong?
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2018 09:12 PM
try to use GlideRecord sys_user_has_role table
var grRole = new GlideRecord('sys_user_has_role');
grRole.addQuery('user',gs.getUserID());
grRole.addQuery('role.name','service_desk');
grRole.query();
if(grRole.hasNext()){
query_table.addQuery('kb_knowledge_base','d23ea8020f39df04c1931b2be1050e21');
}
query_table.addActiveQuery();
return query_table.getEncodedQuery();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2018 07:17 PM
Hey Thanks, the filter worked. Can you also suggest on sorting the result in filter config?
In the above code we are placing a filter on the Knowledge base but instead can we somehow sort the Search Result based on the Knowledge base.
For e.g. Knowledge Base Service Desk should show in the top.
In UI Element to Filter in Contextual Search, you mentioned about the sort option but the HI team said its not possible to sort using Knowledge Base by editing the Search Resource Property. INT3766934
My idea is to Glide Record the Knowledge table, sort it using KB and return the results from filter configuration. Do you have any other suggestions?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2021 01:40 AM
Hey we have a requirement that in response email there are kb links attached which comes based on description we want it only fromlegal kb articles not from all kb articles please help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2020 07:14 AM
Hi Gurprret,
I have a similar requirement where I need to display only the Knowledge Articles pertaining to the "Information Technology (Customer)" Knowledge Base as below :
However, this is not working.
Can you please help me understand where I am missing out?
Thank you,
Ayshee Chattopadhyay