- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-01-2024 09:53 PM
Hi All,
I need help in one use case in Virtual Agent.
I am giving one static choice to users and I am trying to store the input from that static choice then I need that value in another topic based on which I will define some conditions.
What I did:
After defining choices, I have included one script Action to store the values:
Topic 1:
Topic 2:
Thanks
Vedant
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-01-2024 10:04 PM
Hi,
Have you create script variables to store the value?
Update your script action to store value:
(function execute() {
vaVars.selectedCategory= vaContext.select_topic_related_to_your_problem;
})()
try below:
(function execute() {
if(vaVars.selectedCategory == 'Software and Apps')
return true;
})()
Thanks
Anil Lande

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-01-2024 10:04 PM
Hi,
Have you create script variables to store the value?
Update your script action to store value:
(function execute() {
vaVars.selectedCategory= vaContext.select_topic_related_to_your_problem;
})()
try below:
(function execute() {
if(vaVars.selectedCategory == 'Software and Apps')
return true;
})()
Thanks
Anil Lande

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2024 03:50 AM
We haven't heard from you on this, is your issue resolved?
If yes, would be happy to know the fix/solution.
Thanks
Anil Lande

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-01-2024 10:41 PM
Hi there,
Haven't tested, though looking at the code you are sharing the error looks valid to me. You are not setting vaVars.selectedCategory with any value.
I am wondering why you are using the topic switcher (I assume this is topicSwitch?), since this is an older method from years ago and Virtual Agent did evolve over the years with newer/better methods.
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field