Virtual Agent current interaction record via script

Sean C
Mega Guru

Is there a method to get the current Virtual Agent [Interaction] record in a virtual agent script?

I am trying to access the current interaction record at the end of a conversation to determine if a live chat has occurred or not (based on assigned to either being the Virtual Agent Bot or a real person)

So far i have tried the obvious stuff based on the documentation out there,but nothing specifically mentions this capability.

The 'current' and 'vaSystem' objects do not appear tied directly to the interaction unless i'm accessing them incorrectly

 

Anyone ran into a similar situation and solved this?

 

[Update]

vaVars._interaction_record_sysid will give you the interaction sys_id

and

vaVars.global_vCurrentTopicId will get you the current conversation id

1 ACCEPTED SOLUTION

I updated the main topic with a solution, thanks for the help everyone

View solution in original post

18 REPLIES 18

That doesn't look the system log? How are you testing this? If you are using the preview: no go, won't work.

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

I was using the virtual agent previewer before

I changed it to try to output as a bot response so I can test it outside the previewer and seem to run into the same issue running the chat from /$sn-va-web-client-app.do

I made it the first message in our greeting topic

find_real_file.png

find_real_file.png

find_real_file.png

find_real_file.png

If i use the full JSON line you provided I get the bot technical issues message

JSON.parse(vaVars._topic_current).task

find_real_file.png

I updated the main topic with a solution, thanks for the help everyone

Don't leave us in suspense! How did you figure this out??

I opened a Hi Support Case, I'm not sure how anyone would find these hidden variables without asking the SN support.

Object.keys(obj) *should* be able to find things like this, but doesn't seem to work in most cases.

From searching around these vaVar variables prefixed with "_" appear to be undocumented.