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

Hi there,

Yes and no. There's no actual vaSystem property for this directly. Though, there's a workaround 🙂

(function execute() {

    return 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

Hello,

thanks for your post that's helps me 🙂

Where I can find details on vaVars differents fonction like vaVars._topic_current or vaSystem.switchTopic()

Do you have some documentation with theses commands ?

Kinds regards,

Hi there,

Not sure what you are asking, though maybe this helps:
50+ (Un)documented Virtual Agent variables (vaInputs, vaVars, vaContext, vaSystem)

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020, 2021 ServiceNow Community MVP
2020, 2021 ServiceNow Developer MVP

---

LinkedIn
Community article, blog, video list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Thanks 🙂