Is there a script to get the name of the current topic in Virtual Agent

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2020 03:34 AM
Hello,
Is there a script that I can use in a topic to get the name of this current topic and save it in a variable?
Thank you!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2020 04:08 AM
To add: vaVars._topic_current would give you something like:
{"sys_id":"79ce168ddb4a88d0b9f39026db9619cc","task":"62a63689dbca88d0b9f39026db96199a","name":"Test Switch Child","title":"Test Switch Child","type":"normal","utterance":""}
So I just parsed this by using JSON.parse(vaVars._topic_current).name;
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
LinkedIn
Community article list
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
03-27-2020 08:42 AM
I'm very intersted to know what is the use case? 🙂

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2020 05:16 AM
Hi,
Well, we are now implementing Virtual Agent in our environment, but we are still on New York release and it's not clear when we are going to upgrade our instance. So we have a lot of conversations that finish with a question to the user whether he/she wants to contact our live support or raise an incident if the steps provided by VA didn't help. I decided to create this Contact live support/Raise incident block as a separate topic and call it with vaSystem.switchTopic() wherever I need it, but I wanted to take the name of the topic and put it in the Short description of the ticket since this block is going to be used for many different topics it is not applicable to be static.
Regards
Ivan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2020 11:17 PM
Hi there,
Did this solve your question? Or do we need to follow-up on this?
Please mark this answer as correct if it solves your question. This will help others who are looking for a similar solution. Also marking this answer as correct takes the post of the unsolved list.
Thanks.
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
LinkedIn
Community article list
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
06-24-2020 12:37 AM
Hi
I want to get the topic sys_id or name in the topic condition.Is it possible?
Please help!