The CreatorCon Call for Content is officially open! Get started here.

Matt Hernandez
Tera Guru

Today our Servicenow group was required to quickly create a "COVID Knowledge" Virtual Agent topic, and make it display on a portal page. This had to be done for a demo, and we could not tamper with the existing topic being used on our main Service Portal. So the requirement sounded something like this: 1) while having an existing virtual agent running on a certain portal with one topic, implement a second Virtual Agent on a different portal with a different topic, 2) without touching the "main" virtual agent topic configuration.

You could also restate it something like, "Can I put a Virtual Agent widget on a new portal and force it to run only a certain topic?"

Believe it or not, for someone new to Virtual Agent it was very hard to find the answer to this. I was forwarded links to terrific pages in this Community, with lots of links and a ton of information, but this just created a bewildering sea of information and I struggled to not be swept away. My technical support Rep showed me a functioning widget on a page, but he said he had customized the widget and he neither remembered how he did it, nor had time today to give me his code.

After seeing an elusive "sample" my first thought was to put an instance of Virtual Agent Service Portal Widget on a portal page and hard code the topic=<sys_id> into the instance options variable:

	"va_url_params": {
		"value": "sysparm_topic=f3a2ccb31b39ac907d48cbbe034bcb3a&sysparm_skip_load_history=true",
		"displayValue": ""
	}

After all, this va_url_params was already in the instance options, and it seemed like the simple way. But it didn't work. It was ignored by the widget. I asked questions in several places online today and searched the main Servicenow Community but was only faced with the question, "...If there are hundreds of VA articles about everything under the sun, why does no one mention a working model of how to do this?" Usually when find yourself in that situation, it means you are doing it wrong--asking the wrong question. But there is no one smart enough or available to tell you. So maybe I *AM* doing it wrong. I have the feeling maybe the recommended way is to have a single VA and start with a topic and then branch to other topics depending on some kind of answer from customer. But I was not allowed to do that today, I just needed to FORCE a new portal immediately to a specific topic, while leaving the existing VA completely untouched.

The solution I found was this: set the property for the topic directly in a new Agent Chat configuration which contains only the desired portal.

We had an existing Agent Chat configuration, "Service Portal Login Chat". It was being forced onto our existing site by being set as a Setup Topic, and configured as the greeting. So technically the person who configured our existing portal didn't know how to specify a topic either. But the need had not arisen and they just "hit it with a hammer."

find_real_file.png

I added a new Agent Chat configuration, "Web Center Agent Chat," set for only the new portal. Then I configured the properties for topic and skip_load_history:

(function($sp) {
	var portalGr = $sp.getPortalRecord();
	return {
		live_agent_queue: $sp.getDisplayValue('sp_chat_queue'),
		skip_load_history: true,
		topic: 'f3a2ccb31b39ac907d48cbbe034bcb3a'  //mine, use your own!
	};
})($sp);

I got this idea when watching a Virtual Agent Academy video from Mark Roethof, when I saw him put the skip_load_history property here. Since I had previously found articles suggesting topic and skip_load_history could be passed as URL params but I failed to make them work via widget instance options, my heart leapt when I came to 08:48 in the video.

Since I had spent all day trying to find someone who knew how to force a topic on the widget like this, I had to share this article and hopefully it will help someone else. Hats off to you Mark Roethof.

(Note: of course I did slightly touch the existing Service Portal VA configuration, once I understood the solution. I set the topic on its Agent Chat configuration the same way I did for the new portal. Then I removed it from being the General Settings greeting. BOOM. Both portals using their separate topics.)

Comments
Ankita Sarkar
Tera Guru

Hi @Matt Hernandez 

This article is really useful. My query is can we have different topics (more than one) in Topic Picker in different virtual agent widgets placed in different portals by using this approach? Both VA topic picker should contain different topics and should not coincide.

Thank You,

Ankita Sarkar

Matt Hernandez
Tera Guru

Hello Ankita,

Thanks for the feedback. I am quite brand new to Virtual Agent, and I was only looking for my very specific use case, forcing a Virtual Agent to directly launch ONE topic. I have not tried making multiple topics available through this method, and I'm not familiar with all the capabilities of the Agent Chat configuration script.

My advice would be to explore the possibilities using the video series Virtual Agent Academy or the Now Learning materials at Developing Virtual Agent Topics if you prefer a step-by-step-document experience. These are the best materials I have found so far, but I haven't worked through either of them yet, so I'm barely able to give any advice.

If I am to "guess" at the answer to your question, I would say my approach allowed me to set the "starting" topics for two separate portals. I suspect you could use the designer to build out each starting topic into its own "flow" with ability for switching to multiple other topics. However I'm not experienced enough yet to recommend that approach. Possibly its better to start both portals with the same initial topic, and then branch into other ones based on checking a variable inside the flow. This kind of architectural advice could probably be gained from the training links I provided above. Good Luck!

Mark Roethof
Tera Patron
Tera Patron

Hi there,

You could use the conditions on the topics, having topics for example depending on which Portal you are on. Is that what you are after?

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

Ankita Sarkar
Tera Guru

Hi @Mark Roethof ,

Thanks for providing the information! Yes, I want to have different topics for different portal. 

Mark Roethof
Tera Patron
Tera Patron

Are you using Agent Chat Configuration or are you using a method like widget adding directly on a page / embedding to a header/footer?

If Agent Chat Configuration: then you could use vaContext.portal

See:
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 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

PaKe
Kilo Sage

Hi @Matt Hernandez 

Thank you for this article. I searched for a long time to find an answer for this question. 

Can I use my own category and the Setup Topic from the General Settings with, e.g. the Greetings?

 

Best Regards, 

Pascal

Vibhor2
Tera Contributor

Hi @Matt Hernandez 

 

Thank you very much for this useful information.

This information is absolute gold, if we are using the Agent chat widget and wanted to default to a topic.

Only issue I am seeing if I use this configuration, Live agent option is getting grayed out and there is no way user can connect to Live agent. Can you please share your experience with Live agent functionality along with the defaulting to a topic setup.

 

Matt Hernandez
Tera Guru

Unfortunately my company does not use Live agent chat with ServiceNow yet. I haven't really explored it. Sorry I can't offer any good experience on that!

WillWitten
ServiceNow Employee
ServiceNow Employee

Good evening!

You could complete this by using the default_topic sysparm instead of topic. Topic was intended for use in testing.

 

More information on URL Parameters for the Virtual Agent can be found here

https://docs.servicenow.com/bundle/rome-now-intelligence/page/administer/virtual-agent/reference/va-sysparm.html

 

Please mark my comment helpful if I was able to help!

Conrad Woollatt
Tera Contributor

Hi Mark,

 

Are you aware of any other methods to hide topics from a particular virtual agent? As if you use the NLU then it searches all topics unless you explicitly update all the topics you dont want it to reference.

Nikita40
Tera Contributor

Hi Matt,

 

This solution worked. But still, I am facing issue. We have made one specific content visible through this but when user enters create incident, still user is getting content for incident creation. how can we hide this for respective portal.

 

Matt Hernandez
Tera Guru

@WillWitten wow, OOPS. haha

thanks for that feedback, I missed it back when you wrote that.

 

@Nikita40 it sounds like you are just looking to exclude certain topics from specific portals. I think there are probably multiple ways to do that but I don't have specific advice for it. I believe there are multiple places around VA where you can set conditions to filter topics. I would recommend to carefully search for configuring topics in the Virtual Agent Academy videos. It is a very thorough series! 
Virtual Agent Academy playlist 

Timothy Onyskin
Tera Contributor

Is there a way to make VA "page aware" in the same portal?  What I mean by that is, let's say that a person is on the main/only portal.  They are looking at an IT page and hit the floating VA icon that is in the lower right.  The first set of topics presented to them is the IT specific part of the master VA tree (top level is generic, next level is the top of the departments... IT, HR, etc...).  If they were on an HR page off of the same main/only portal, the first set of topics would be down on the HR section.  Of course as part of both of those subtrees/topics, they would have an option to go back up to the main part where they could then use any part of the topics or use NLU to search across everything. Is there a parameter that I could grab in order to direct the VA to the correct topics?

tdexter
Tera Contributor

Does this still work for you? 

 

I've done it as described and whenever I set the topic value in the configuration the chat then just gives me a blank message and the user input is greyed out. This happens with any topic. If I don't set the topic, the default loads fine. 

Version history
Last update:
‎01-26-2021 09:30 PM
Updated by: