After working on Virtual Agent for a long time now we have realized it is a great plugin and we want to share this knowledge and lessons we learnt during all this time to ease your work. we’ll guide you through Virtual Agent Best Practices, Tips and Tricks and will go through the docs with a more simple language.

If you had ever visited this page on ServiceNow Docs, you as well might have seen this picture :

How to read the Docs - Virtual Agent - Part 1

Have a look at Knowledge results shown in the above screenshot. It contains Article Numbers. But How the results are actually displayed using Virtual Agent? Have a look at below screenshot from a OOTB Topic ‘Search Knowledge Base’ (Provided with ‘ITSM Virtual Agent Conversations’ Plugin) :

How to read the Docs - Virtual Agent - Part 1

Yup. There are no article numbers when used OOTB search.

We had the requirement to make our knowledge search like one shown in the above screenshot. So are you ready to see how did we achieve it?

Step 1) Search for the existing OOTB Topic and Open It.

How to read the Docs - Virtual Agent - Part 1

Step 2) Click ‘Duplicate’.

How to read the Docs - Virtual Agent - Part 1

Step 3) Give it a unique name and click ‘Save’.

How to read the Docs - Virtual Agent - Part 1

Step 4) Click ‘Edit Topic Flow’ in newly created Topic Properties Page.

How to read the Docs - Virtual Agent - Part 1

Step 5) In the designer canvas, locate the bot response ‘Display KB(s)’ that display’s knowledge results.

How to read the Docs - Virtual Agent - Part 1

Step 6) Open ‘Link List Value Expression’ script from response properties.

How to read the Docs - Virtual Agent - Part 1

Step 7) Replace the OOTB Script with the Script given below and click ‘Save’ :

(function execute(header) {
var groupedLinksOutMsg = new sn_cs.GroupedPartsOutMsg();
groupedLinksOutMsg.setHeader(header);
var limit = parseInt(vaVars.limit);
var searchJsonObj = JSON.parse(vaVars.search_kb_json_string);
var index = parseInt(vaVars.index);
var linkBuilder = new global.cxs_SearchResultLinkBuilder();
test = 'OK. Before creating your incident, here are some KB articles that may help.';
test += '';
for (var i = index; i < index + limit && i < searchJsonObj.length; i++) { var link = linkBuilder.build(searchJsonObj[i], vaInputs.portal); var articleLink = link.link; var articleNumber = articleLink.match(/KB\d{7}/); test += ''; } test += ' < table style="text-align: left;" >
< tbody >
< tr >
< td colspan="2">< /td >
< /tr >
< tr >
< th style="width: 30%;">KB Number< /th >
< th >Short Description< /th >
< /tr >
< tr >
< td >< a href = "'+ articleLink + ' " >'+ articleNumber + '< /td >
< td >' + link.label + '< / td >
< / tr >
< / tbody >
< / table >
';
return test;
})(header)

How to read the Docs - Virtual Agent - Part 1

Step 8) Locate the Bot Response ‘Found Result Message’ and delete it.

How to read the Docs - Virtual Agent - Part 1

Congratulation, You have created a customized Incident Display Card. Now all you need to do is add your custom topic block to the Topic.

Follow the Steps given here, to add our customized topic block to the Topic. Once you perform the steps mentioned in this link you can see the result.

How to read the Docs - Virtual Agent - Part 1

Emergys Blog

Recent Articles

  • Suite on HANA Migration

    Effective & Efficient Suite on HANA Migration for a Global Automotive Brand

    Effective & Efficient Suite on HANA Migration for a Global Automotive Brand

    This success story explores effective and efficient SAP Suite on [...]

    This success story explores effective and efficient SAP Suite on HANA migration for a global automotive [...]

  • Agentic AI

    Agentic AI Helps Industrial Firm Transform Its RFP Response Process

    Agentic AI Helps Industrial Firm Transform Its RFP Response Process

    Creating RFP response content is a time-boxed process which [...]

    Creating RFP response content is a time-boxed process which places the RFP team under duress, [...]

  • SAP System with EHP8

    Maximize Efficiency and Future-Proof Your SAP System with EHP8

    Maximize Efficiency and Future-Proof Your SAP System with EHP8

    Organizations running on SAP ECC are increasingly challenged by [...]

    Organizations running on SAP ECC are increasingly challenged by rising maintenance costs, performance limitations, and [...]