Solution - How to share variables between topics, hide topics and control conversation based on the value selected by the end user
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-09-2022 01:44 AM
Firstly apologies if a solution to this problem is already out there. I've personally not been able to find one after searching in the community forums and documentation.
To start with a big of background info. I had a requirement where I needed to pass variables between different topics as well as be able to call upon variables at will. These variables would be used to hide or show different topics to the end user via the topic discovery as well as decide their route within topics depending on the value of the variable.
My solution was to add some fields to the interaction record form. During the greetings topic, the user would be presented with a couple of options, the outcome of these options would then be recorded on the most recent interaction which has been created by VA for that individual user. I would then use a condition script on the topics to query the interaction record to obtain the value they had selected and decide if the applicability was set to true or false (show or hide). Further, into the conversation, a simple topic block could then be accessed whenever needed that again would query the interaction record and return the value of the option selected. Using this topic block, I was then able to determine the path the user should follow within the topic.
This solution has worked amazingly well for me and avoids having to create multiple topics for similar processes, it is really good for hiding topics from the show more topic discovery as well as having the ability to store values from the user that would otherwise result in asking the same question several times. Having the ability to store values on the interaction record is super helpful and can be used during a conversation, but also reported on very easily.
I would be happy to share more specifics with the community on this solution if anyone is interested.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-09-2022 05:44 AM
Good morning, Have you tried using the context/live agent variable options? This area explains a few options
https://docs.servicenow.com/bundle/sandiego-servicenow-platform/page/administer/virtual-agent/concept/virtual-agent-scripts.html

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2024 09:18 AM
Is there anything you all can do to make the links in these posts WORK across versions? It is very frustrating when I read something and think, "Yes - that is exactly what I need", only to click the link and be sent to a random home page.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2023 12:59 PM
Hi Andy, I hope everything is going fine, how did you record the variables value on the most recent interaction of VA? I mean, did you use vaContext.[yourVariable] = [variableValue] ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2024 06:44 AM