Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

How to fetch and display dynamic External search links in Virtual Agent when Catalog Item is empty

rah dev
Tera Contributor

Hi Everyone,I am designing a Virtual Agent flow where the user inputs a keyword to search for a Service Catalog item.Yes Path (Working Perfectly): If the item exists in the ServiceNow catalog, it routes to the "Yes" branch and displays the catalog link.No Path (Need Help): If the item is NOT found in our catalog, the flow goes to the "No" branch.My Requirement:On the "No" branch, instead of showing internal KB articles, I want the bot to dynamically search the web (like Google Search) using the user's input keyword, and directly provide the specific external search result links into the chat canvas.What I need help with:What is the best way to trigger a Google/External search from the "No" branch using a Script Action or REST API node?How can I map the external URL response so it displays as clickable links/cards for the user?Any step-by-step guidance, integration steps, or script snippets to achieve this fallback external search would be highly appreciated!(I have attached the screenshot of my current canvas flow below for reference).

rahdev_0-1784113116071.pngrahdev_1-1784113134921.pngrahdev_2-1784113142836.png

 

1 REPLY 1

Vikram Reddy
Tera Guru

Hello @rah dev,

 

Drop a Script Action (under Utilities in the component palette) right after your Decision node on the No branch, that's your server-side hook, and there's no separate REST node. Inside it, call an Outbound REST Message via sn_ws.RESTMessageV2 against a real search provider, never Google directly from a script (breaks their terms, and your instance IP gets throttled fast). Store the parsed results in a vaVars array. For rendering, skip Card and Link, they're static one-URL-each controls, and use the Script bot response control instead, it builds the response markup at runtime so you can loop over a variable number of result links.

References

 

Thank you,
Vikram Karety
Octigo Solutions INC