Get "search term" of Topic discovery search inside the topic if topic starts directly. | Virtual Agent | VA | NLU

Mr world wide
Mega Guru

Hello everyone,

When VA Virtual agent communication is started it shows the greeting message and asks the user to select from "Show Me Everything Button" or Typing a Keyword/Sentence will do the NLU search and shows the results of topics,

find_real_file.png 

find_real_file.png


During the topic discovery process (matching intents to topics), Virtual Agent returns the most relevant topics for a user's request. The topic discovery process returns these results to a user:

  • Single match: When a user utterance directly matches an intent (topic), the topic runs automatically.
        >Topic starts directly
     
    My question:
    When the topic started directly, I want to know by using what search team user landed on this topic?

    I can't able to get the initial(topic discovery search term) search team.

    Tried the following scripts but no luck
    (function execute() {
    	var res = '';
    	
    	//Tried all the following but nothing is working
    	
    	/* vaVars */
    	res = vaVars.global_search_text;
    	res = vaVars.search_term;
    	res = vaVars.global_preChatExecuted;
    	
    	/* vaSystem */
    	res = vaSystem.global_search_text;
    	res = vaSystem.search_term;
    	
    	/* vaInputs */
    	res = vaInputs.global_search_text;
    	res = vaInputs.search_term;
    	
        return res;
    	
    })()

     

    I have a contextual search inside my topic I want to trigger a contextual search with the topic discovery search term

    find_real_file.png

    Help is appreciated,

    Thanks

1 ACCEPTED SOLUTION

Mr world wide
Mega Guru

I found it community after a long time:

Using the below code we can get the topic search text on the topic.

vaSystem.getSearchText();

View solution in original post

3 REPLIES 3

Mark Roethof
Tera Patron
Tera Patron

Hi there,

This will help you:
50+ (Un)documented Virtual Agent variables (vaInputs, vaVars, vaContext, vaSystem)

Mentions amongst others vaSystem.getSearchText()

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020, 2021 ServiceNow Community MVP
2020, 2021 ServiceNow Developer MVP

---

LinkedIn
Community article, blog, video list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Mr world wide
Mega Guru

Hi Mark,
Thanks for the response.

When I was looking for solution in the community I landed on your blog post (Article) > 50+ (Un)documented Virtual Agent variables (vaInputs, vaVars, vaContext, vaSystem).


Unfortunately, it's not helping my basic/simple requirement.

 

I want to retrieve the search term used for NLU search inside a topic.

 

 

Mr world wide
Mega Guru

I found it community after a long time:

Using the below code we can get the topic search text on the topic.

vaSystem.getSearchText();