How to check if a VA Topic was triggered from NLU or if a user selected it from topic picker?

Nisarg Thakur
Tera Guru

Hello,

I am wanting to add a condition in my virtual agent topic where if the topic was triggered from an NLU, then perform certain actions, if a user manually selects it, then skip those steps. How do I check that in the designer?

find_real_file.png

Any suggestions appreciated! Thank you!

2 REPLIES 2

Richard Kiss1
Kilo Guru

Hi Nish,

 

There is a system variable called vaSystem.getSearchText(). According to the docs: "This method returns the last utterance typed by the user and is used to find the current topic."

 

If you select manually, the variable will not have a value, if you perform a search, it will have a value. Just created a small topic to test it:
find_real_file.png

 

The conditions are:

NLU: return !gs.nil(vaSystem.getSearchText())

Manual selection: return gs.nil(vaSystem.getSearchText())

 

The outcome is this:

NLU search
find_real_file.png

Manual selection from the Show me everything:

find_real_file.png

I hope this helps.

 

Richard

MB Richards
Tera Contributor

@Richard Kiss1  thanks for this, worked like a charm!