We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

How to search on specific fields and search terms in Virtual Agent Search Knowledge Base

Serkan Yilmaz1
Giga Contributor

Hi SN Community members,

I'm looking for a method that can be used to search on specific fields in the "Search Knowledge Base" topic. 

In the "Search Knowledge Base" topic there is a Script action "Contextual Search" and this uses the input from the previous User Input box. 

    var search_term = vaInputs.search_term;
    var context = vaVars.search_context_sys_id;
    var contextualSearch = new sn_itsm_va.VAContextualSearchUtil();
    var response = contextualSearch.search(context, search_term);
    var success = contextualSearch.processSearchResponse(response);

This works fine, but I want to know if there is a way to push more specific search actions into the search action (e.g. "category=ABC" -or- "Author=XYZ"). 

 

 

Another way of doing it is also fine for me, but the search should "respect" the data security (User Criteria).

Hope to hear from some of you!

 

Cheers,

Serkan

5 REPLIES 5

i was trying to add this in script include and that did not work. i have to give a try in service portal api.

i will create a new topic and will add script action with the above code.