Dynamic choice input is not returning value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2024 12:27 AM
Hi All,
I am facing issue with one thing. In Virtual Agent I am using Dynamic Choice Input. Where I am writing this code to print choices, so Choices are printing successfully, but when the user is selecting any choices from it, then technical issue is coming.
one more thing, at the place of topicSysId if we give any hardcoded sysid it is working fine.
In logs I checked selectedCategory is showing as undefined but it is defined in some other topics where I am giving values to selectedCategory, so why I will define here.
Kindly Guide
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2024 01:15 AM - edited 01-08-2024 01:16 AM
Yes but have you defined selectedCategory within the step your question is about? If I look at the code: no you did not.
For example, perhaps:
var topicSysId = sysPropertyObject[selectedCategory];
Should be:
var topicSysId = sysPropertyObject[vaVars.selectedCategory];
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2024 01:19 AM
@Mark Roethof
Thanks, but I tried this way also, but it is not giving me output. Though it is not giving errors but not giving proper output also.
Lets say in first topic value of selectedCategory is Hardware, so ideally in second topic also it should come as Hardare, but if I am using vaVars.selectedCategory, then empty is coming.
Anything I am missing?
Thanks for help

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2024 01:24 AM
Are you passing the value to the other topic? (I thought this was about steps within a topic, my bad)
Just using the same vaVars over different topics does not work.
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2024 01:32 AM
@Mark Roethof
Then can yo please help what I can do?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2024 02:11 AM
Instead of vaVars, you could try to use Context Variables.
From the Docs:
"They work in a global scope whereas system variables work within the scope of the topic. You can use context variables anywhere in the conversation using the vaContext
object."
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field