Skip user input from Submit a service request
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2024 10:00 AM
When user types utterance system identifies the Submit a service request topic and confirm if it is correct topic and if user confirm yes system asks user again to provide what they want to submit, can we instead get the previous input and display search results ?
Below image I want system to show results for Submit Okta request utterance instead of asking again what they are looking for.
I have tried vaSystem.getSearchText() before Search Input node but topic is failing.
Any idea @Mark Roethof @Victor Chen @Chris D

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2024 01:56 PM - edited 10-10-2024 02:05 PM
What do you mean by "topic is failing"? vaSystem.getSearchText() should be exactly what you need. We do something virtually identical in a topic: it starts with a search_text user input with a Hide condition if vaSystem.getSearchText().length < 20 (you could also just skip this node if an utterance exists). And then in the following search input (it's actually the Contextual Search topic block), it's just a simple script:
(function execute() {
//if the search text was not provided, use the VA utterance
var search = (vaInputs.search_text) ? vaInputs.search_text : vaSystem.getSearchText();
return search;
})()
This is where that script is for context:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2024 07:12 PM
Thank you for the reply, this is what I have done but topic goes to infinite loop with empty search.
Node gets skipped however search term is not set and blank name is sent to Request catalog item topic block.
Not sure what I'm missing. Thank you!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2024 06:34 AM
I'm a bit unsure what you're doing with four text inputs in a row that all seem to be getting a search term from the user - whether or not it is related to this issue, it seems you're complicating things more than they may need to be...
I presume that last script you're showing (part of) is from "Set Search Term" script action? Can you share that complete script? And also show us what the "search" (or whatever it's called) input of the "Search Catalog Item" topic block is.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2024 06:48 AM
That's the OOB script 🙂 on Submit a request topic, all that I'm trying to do is skip Search Input node and pass vaSystem.getSearchText() as input and display results.
complete script from OOB for Set Search term
(function execute() {
vaVars.search = vaInputs.search.toString();
vaVars.search_catalogitem = vaInputs.search_catalogitem;
vaVars.search_hardware = vaInputs.search_hardware;
vaVars.search_software = vaInputs.search_software;
if (vaInputs.search != ''){
vaVars.direct_search = true;
return;
}
if (vaContext.getRequesterLang() == 'en') {
var gr = new GlideRecord('sc_cat_item');
gr.addActiveQuery();
gr.addQuery('name', vaInputs.search_catalogitem);
gr.query();
while (gr.next()) {
vaVars.catalog_item_id = gr.getValue('sys_id');
vaInputs.catalog_item_id = vaVars.catalog_item_id;
}
} else {
var gr = new GlideRecord('sys_translated_text');
gr.addQuery('value', vaInputs.search_catalogitem);
gr.addQuery('tablename', 'sc_cat_item');
gr.addQuery('language', vaContext.getRequesterLang())
gr.addQuery('fieldname', 'name')
gr.query();
while (gr.next()) {
var gr2 = new GlideRecord('sc_cat_item');
gr2.addActiveQuery();
gr2.addQuery('sys_id', gr.getValue('documentkey'));
gr2.query();
if (gr2.next()) {
vaVars.catalog_item_id = gr.getValue('documentkey');
vaInputs.catalog_item_id = vaVars.catalog_item_id;
}
}
}
if (vaVars.search_catalogitem != null) {
if (vaVars.search_hardware == '' && vaVars.search_software == '')
vaVars.hardware_software_entity_mapped = false;
else
vaVars.hardware_software_entity_mapped = true;
}
})()