Topic Block utility
Summarize
Summary of Topic Block utility
The Topic Block utility in Virtual Agent conversations enables ServiceNow customers to modularize and reuse specific functions or subflows by embedding topic blocks within calling topics. This feature streamlines conversation design by allowing predefined or dynamic execution of topic blocks based on specific conditions or inputs.
Show less
Key Features
- Node Name: Automatically assigned based on the selected topic block but customizable when using dynamic Topic Blocks.
- Use Dynamic Topic Block: A toggle option that activates dynamic selection and execution of topic blocks through conditions or scripts rather than static selection.
- Topic Block Selection: Choose from a list of published topic blocks or use conditional logic to determine which topic block to invoke dynamically.
- Input Mapping: Defines variables passed as inputs to the selected topic block. With dynamic Topic Blocks enabled, inputs are manually managed, supporting various data types including strings, records, and scripts.
- Output Mapping: Specifies the variables returned from the topic block. Dynamic Topic Blocks allow manual configuration of outputs, similar to input mapping.
- Advanced Conditions: Enables conditional display or invocation of the topic block node based on no-code or low-code expressions that must evaluate to true.
Using Dynamic Topic Blocks
The dynamic Topic Block setting empowers customers to programmatically select which topic block to run based on runtime conditions, enabling more flexible and reusable conversation flows. This means you can consolidate multiple topic block invocations into one dynamic block that adapts to input variables and context.
For example, in a password management scenario, a single dynamic Topic Block can handle both normal password resets and two-factor authentication resets by:
- Using a script to evaluate if two-factor authentication is required and choosing the appropriate topic block accordingly.
- Defining input mappings that accommodate all necessary data such as username, password, and 2FA tokens.
- Configuring output mappings to handle success/failure messages and any temporary passwords returned.
Scripts returning the topic block name based on input variables enable branching to different troubleshooting flows dynamically, enhancing conversation adaptability and maintainability.
Practical Benefits for ServiceNow Customers
- Facilitates reuse of conversation logic, reducing duplication and simplifying updates.
- Enables dynamic decision-making within conversations, improving user experience by tailoring flows to specific conditions.
- Supports complex input and output handling, allowing integration of sophisticated data processing within Virtual Agent conversations.
- Improves maintainability of conversation topics by centralizing logic in reusable topic blocks.
Use a Topic Block in a Virtual Agent conversation to perform a specific function or subflow that runs certain steps in a calling topic.
Topic Block utility properties
For more information, see Add a reusable topic block to a calling topic or topic block.
| Property | Description |
|---|---|
| Node name | Name of the topic block node. The name is automatically assigned based on the topic block that you select. For example, if you choose the Acme Contextual Search topic block, the Name is
Acme Contextual Search. With Use dynamic Topic Block active, input a name of your choice. |
| Use dynamic Topic Block | Set this toggle to activate dynamic Topic Block options. |
| Topic block | A list of published topic blocks. Select a topic block to add to the calling topic. With Use dynamic Topic Block active, use the condition builder to input a condition or script instead. |
| Input mapping | The variables to be used as input to the selected topic block. In this example, input mapping variables include catalog item ID, execute contextual search, confirm catalog item, and show end state card. The contents of this area change according to the topic block you selected. Options may include string input, referenced records, scripts, and so forth. With Use dynamic Topic Block active, you add all input mappings manually instead by selecting the Manage inputs to define icon |
| Output mapping | The variables to be output by the selected topic block. For example, the following image has example variables that are enabled: The contents of this area change according to the topic block you selected. With Use dynamic Topic Block active, you add all input mappings manually instead by selecting the Manage outputs to define icon |
| Advanced | |
| Hide this node | |
| Conditionally use this node if | A no-code condition statement or low-code script that specifies a condition for presenting this node in the conversation. The condition must evaluate to true. |
Example Topic Block utilities
The following Topic Block utility properties include the reference to an available topic block, input mapping variables to the topic block, and the output variables that the topic block will pass.
The following Topic Block utility properties have the Use dynamic Topic Block toggle switch turned on.
Using dynamic Topic Blocks
Toggling the dynamic setting on the Topic Block enables you to programmatically choose which topic block or blocks to invoke, based on any number of conditions. You can pass in a dynamic set of inputs without an explicit, one-to-one match for a Topic Block definition.
For example, assume you have two Topic Blocks. One sets your password by taking your username and returning a success or fail message. The other resets your password, but requires that you send two-factor authentication (2FA) token with the request before returning a success or fail message and a temporary password.
You can create two separate Topic Block invocations to handle the password-reset procedure, or you can create one Topic Block with the dynamic setting active and defined as follows:
- Add a script that checks if the reset type is
includesTwoFactor = true. If the statement evaluates to true, then you returnTwoFactorReset, otherwise you returnNormalPasswordReset. - Define two input mappings:
passwordandtwoFactorToken, both set equal to an object passed in which contains their values. - Define two output mappings:
successfulandtempPass, the latter of which is only set if it exists in the return value for the Topic Block. - Define two output nodes to output success or failure, and an output to confirm to you whether the
tempPassvalue is true.
Example dynamic Topic Block expression
(function execute() {
/* Return the name of the topic block to run. For example:
switch (vaVars.car_make) {
case 'Ford':
return 'Ford troubleshooting';
case 'Toyota':
return 'Toyota troubleshooting';
default:
return 'General car troubleshooting';
}
*/
})()The script in the dynamic Topic Block expression returns a value based on your input. In this example, if you input Ford or Toyota, the Virtual Agent will call for the appropriate troubleshooting topic. If you input any other value, the Virtual Agent returns a general troubleshooting topic instead.