How to pass Value from one topic to another in Virtual Agent
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2024 02:05 AM
Hi All,
I have a requirement of passing a variable from one topic to another topic.
I am defining one variable like this to store the user input:
In another topic I am parsing one system Property like this:
But in logs I can see in the second topic where I am fetching the value, it showing selectedCategory is not defined.
How I can make it work so that selectedCategory should store correct value that is Hardware, to give it's corresponding sysId.
Kindly Guide.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2024 02:43 AM
LiveAgent_selectedCategory = vaInputs.select_topic_related_to_your_problem.getValue();
This will result in not defined. Because you didn't do so.
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 07:41 PM
@Mark Roethof So can you please help, how I can write it.
It will be very helpful for me.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2024 08:15 PM
Basically at the start of your script, your just suddenly mentioning out of the blue:
LiveAgent_selectedCategory
That's not possible in any ServiceNow scripting. You do need to define it. So also within Virtual Agent scripting. Like:
var LiveAgent_selectedCategory = 'blablalba';
vaVars.LiveAgent_selectedCategory = 'blablabla';
vaContext.LiveAgent_selectedCategory = 'blablabla';
Etc..
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 08:24 PM
Thanks for your time and reply @Mark Roethof
But you can see here in first topic, I am defining here as:
And in Second topic where I need this Variable's value, I am using it as
So how to define it in second topic so it should work.
thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2024 08:26 PM
"So how to define it in second topic so it should work."
Using vaContext.
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field