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 12:42 AM
Hi there,
"then technical issue is coming"
Usually when this happens, very useful information is written to the logs. What is the logs providing you? Please share.
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 12:47 AM
This I am getting in Logs:
11:26:09.492 Evaluator: com.glide.script.RhinoEcmaError: "selectedCategory" is not defined. Task.77d03cae1beb7d10134bddf59b4bcb14 : Line(13) column(0) 10: */ 11: var sysPropertyValue = gs.getProperty('x_4dai_va.connected_content_id'); 12: var sysPropertyObject = JSON.parse(sysPropertyValue); ==> 13: var topicSysId = sysPropertyObject[selectedCategory]; 14: var options = []; 15: gs.info("line15"+topicSysId); 16: var grObj = new GlideRecordSecure("m2m_connected_content");
But the strange thing is Just before this node I am using a text response where I am printing the value of selectedCategory, it is giving me correct value.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2024 12:58 AM
If I just look at the code that you shared, indeed selectedCategory is not defined. So please do so, or share where you did this. Just looking at what you shared, again you did not define it.
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:14 AM - edited 01-08-2024 01:14 AM
@Mark Roethof
In one topic I have defined it like this:
After this I am using this variable in my topic directly. If this is not the way, can u please guide how i can achieve this