Help
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Mark Roethof
Tera Patron
Tera Patron

Hi there,

With the Orlando release, ServiceNow introduced reusable Topic Blocks for Virtual Agent. Reusable components, which you could compare with Subflows or Actions. A really nice feature that helps build Topics smarter, faster, more consistent and manageable. Also less scripting knowledge is needed when working in Topics, because this logic has been set up in the Topic Block.

In a few short articles, I'll share some of the reusable Topic Blocks I've set up. These Topic Blocks can also be downloaded from Share.

Topic Blocks

A short recap:

Pre-Orlando
Basically pre-Orlando if we would have a repetitive group of steps for multiple Topics or even within a Topic, we simply had to duplicate them/build them over and over. There was no possibility to set up something like a Subflow. Well, maybe a small workaround would be doable for some situations, using vaSystem.switchTopic() or vaSystem.topicDiscovery().

Orlando
With the Orlando reusable a repetitive group of steps for multiple Topics or even within a Topic, can be placed within a "topic blocks". The short explanation of Topic Blocks according to the Docs site:

"A Topic block is basically a Subflow that performs certain actions or conversational tasks in a Topic."


File Picker

When creating or updating Task related records through Virtual Agent, you might have the desire to add attachments. For this, the Virtual Agent designer has the File Picker available (up to the Orlando-release: User Input Image Picker, since the Paris-release: User Input File Picker). A really nice User Input! There is a "trick" to know about using the File Picker though, only applying the User Input File Picker is not enough. You would also need script vaSystem.attachToRecord to relate the File to a (new) record. I've explained this in one of my previous articles:
Virtual Agent User Input File Picker [Paris]

So instead of doing this over and over in multiple Topics, or maybe even multiple times in one specific Topic, let's set up a more generic Topic Block!

To start of, we'll define some Topic Inputs on the Start step, and we need to add the next two User Inputs:

find_real_file.png

find_real_file.png find_real_file.png

The Prompt can be used on the File Picker, and Skippable on the Node Conditions of the File Picker. Table Name and Record SysID will be used within the Script Action. Code for the Script Action could be:

(function execute() {
    
    if(vaInputs.file_picker.getValue()) {
        vaSystem.attachToRecord(vaInputs.file_picker.getValue(), vaInputs.table_name.getValue(), vaInputs.record_sysid.getValue());
    }

})()

Note: For the User Input File Picker name "File Picker" has been used, which automatically provides you with vaInputs.file_picker


Result

Above steps would result in a short Topic Block like:

find_real_file.png

Now we can simply use this Topic Block in Topics using the Topic Block utility.

The Topic Block Properties would ask you to supply seconds (mandatory). This would simply be the table_name, record_sysid (which you can get dynamically using the Data Pill), and a prompt message to display.

find_real_file.png

The ultimate result would be an additional step being shown in your Topic which looks something like below, and after related the File to your record.

find_real_file.png

Share

An Update Set with this Topic Block can be downloaded from Share:
- Virtual Agent Topic Block: Fle Picker

---

And that's it actually. Hope you like it. If any questions, remarks or other ideas for Topic Blocks, let me know!

👍
If this post helped you in any way, I would appreciate it if you hit bookmark or mark it as helpful.

Interested in more articles, blogs, videos, and Share projects on Virtual Agent I published?
Virtual Agent


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

---

LinkedIn

Comments
gesaokfri
Kilo Contributor

Halo Mark,

How to change this words?

find_real_file.png

Version history
Last update:
‎12-10-2020 12:36 AM
Updated by: