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

Ivan Delchev
Giga Contributor

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!

 

9 REPLIES 9

Mark Roethof
Tera Patron
Tera Patron

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

LinkedIn

NaAs
ServiceNow Employee
ServiceNow Employee

I'm very intersted to know what is the use case? 🙂 

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 Roethof
Tera Patron
Tera Patron

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

LinkedIn

mrafi
Giga Contributor

Hi @Mark Roethof , Can i access VaVars Variable in the topic condition itself ?

I want to get the topic sys_id or name in the topic condition.Is it possible?

Please help!