How to grab the initial user input in the VA "please type your request" for later use as the description in an incident?

LeroyPouw
Kilo Contributor

Hello,

I am new here and have little experience with VA's. What I would like to do is the following: 

I would like to grab the initial input given by the user of the VA and use this input later as a description in an incident. 

find_real_file.png

The input given here under "Please type your request"

 

find_real_file.png

Needs to end up here in the description (topic block used to create an incident). I guess we need to run a script? 

I already tried to make use of "vaVars.global_search_text" and "vaSystem.topicDiscovery()" which I found as the answer to this question: https://community.servicenow.com/community?id=community_question&sys_id=2a5e43cbdb58181413b5fb243996...

Unfortunately I have no experience with javascript and the above didn't bring me any further. I hope that what I want is even possible and that some of you can help me. Thank you in advance!!

1 ACCEPTED SOLUTION

Susan Britt
Mega Sage
Mega Sage

If the user typed something in, it can be found in vaSystem.getSearchText().  If they selected something from "Show Me Everything" button, that Topic/Intent name can be found with JSON.parse(vaVars._topic_current).name;

View solution in original post

3 REPLIES 3

Susan Britt
Mega Sage
Mega Sage

If the user typed something in, it can be found in vaSystem.getSearchText().  If they selected something from "Show Me Everything" button, that Topic/Intent name can be found with JSON.parse(vaVars._topic_current).name;

LeroyPouw
Kilo Contributor

Thank you sbritt! It worked. 

We made a script variable and now use this script to get the initial input where we want it. 

thanks again! 

 

(function execute() {

 
var desc = vaSystem.getSearchText();
return desc;
})()
 

if im using a short description input at the beginning of the conversation topic where in the setting should we paste vaSystem.getSearchText();

 

ex: if initial search is empty, show short description, else if initial search has value skip short description question

 

thank you!