{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":4914,"path":"conversational-interfaces/virtual-agent/create-topic-blocks.md","title":"Create a reusable topic block","bundle":null,"doc_type":null,"release":"australia","body":"\n# Create a reusable topic block\n\nBuild a reusable component that performs a specific subflow of tasks and conversational elements in Virtual Agent conversations.\n\n## Before you begin\n\n**Tip:** Developers and topic authors may need to access topic blocks created in other application scopes. To give them access, see [Configure cross-scope access privileges for topic blocks and custom controls](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/conversational-interfaces/virtual-agent/configure-cross-scope-privileges.md).\n\nRole required: virtual\\_agent\\_admin or admin\n\n## About this task\n\nUse topic blocks to run common steps, such as retrieving certain records.\n\n## Procedure\n\n1.  Navigate to **All** &gt; **Conversational Interfaces** &gt; **Assisant Designer**.\n\n2.  Select the **Asset library** tab.\n\n3.  In the Asset library, set the topic discovery toggle switch to **LLM** or **NLU/Keyword** depending on which type you want to work with, then do one of the following:\n\n    -   To create a topic block from scratch, select **Create asset** or **Create topic**, depending on your topic discovery setting.\n    -   To create a topic block based on a pre-built topic block, open the topic block and do the following:\n        1.  In the header bar, select **Duplicate**.\n        2.  Enter the name of the new block and select **Save**.\n4.  On the sheet, fill in the fields.\n\n<table id=\"table_jlp_q1z_njb\"><thead><tr><th>\n\nField\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nType\n\n</td><td>\n\nList of items that you can create in Assistant Designer Asset library.\n\n Select **Topic Block** and define the additional properties.\n\n**Note:** Once you set this topic as a topic block, you cannot change it to a regular topic.\n\n</td></tr><tr><td>\n\nName\n\n</td><td>\n\nUnique name for the topic block that reflects its functional purpose. This name appears in the list of topic blocks that topic authors can choose from when creating or updating a topic.\n\n</td></tr><tr><td>\n\nDescription\n\n</td><td>\n\nBrief explanation of the purpose of the topic block. For example, to retrieve records.\n\n</td></tr><tr><td class=\"sub-head\" colspan=\"2\">\n\nAdvanced properties \\(optional\\)\n\n</td></tr><tr><td class=\"sub-head\" colspan=\"2\">\n\nWho can access this topic\n\n</td></tr><tr><td>\n\nChannels\n\n</td><td>\n\nChat clients in which the topic or topic block will run.\n\n These channels are different from the default channels that are natively supported by Virtual Agent. Your instance may have additional channels for [custom chat integrations](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/conversational-interfaces/virtual-agent/va-custom-adapter-framework.md) created for it. For more information about channels, see [Deploying Virtual Agent topics in other channels](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/conversational-interfaces/virtual-agent/va-integrations.md).\n\n</td></tr><tr><td class=\"sub-head\" colspan=\"2\">\n\nLive agent\n\n</td></tr><tr><td>\n\nLive agent context variables\n\n</td><td>\n\nLive agent context variables that are defined in the [General Chat Settings](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/conversational-interfaces/ac-configure-context-variables.md).Select the variables that provide dynamic context, which means information from the Virtual Agent chat. This information is transferred from the bot conversation to the live agent.\n\nFor information about the default list of live agent variables, see [Live agent chat context variables](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/conversational-interfaces/live-agent-chat-context-vars.md).\n\n</td></tr><tr><td>\n\nAvailable for Agent Autopilot\n\n</td><td>\n\nToggle switch that determines whether the topic block is available to a live agent.When enabled, an agent can search for the topic and invoke the topic. For details, see [Conversation Autopilot](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/conversational-interfaces/agent-chat/ci-agent-chat-using.md).\n\n</td></tr><tr><td class=\"sub-head\" colspan=\"2\">\n\nAvailable on the palette\n\n</td></tr><tr><td>\n\nEnable\n\n</td><td>\n\nToggle switch that determines whether the topic block appears as its own icon in the Utilities section of the palette on the **Flow** tab. This provides easy access to the topic block for other authors.\n\n</td></tr><tr><td class=\"sub-head\" colspan=\"2\">\n\nAdditional\n\n</td></tr><tr><td>\n\nCategories\n\n</td><td>\n\nCategory that contains this block. You can define [custom topic categories](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/conversational-interfaces/virtual-agent/create-topic-category.md) for your topic blocks.\n\n</td></tr></tbody>\n</table>5.  Select **Create asset**.\n\n    The **Flow** tab opens. The canvas displays a flow with a **Start** and **End** node.\n\n6.  To define an input to the block, do the following:\n\n    1.  Select the **Start** node in the canvas.\n\n    2.  In the Start Segment Properties sheet, select **+ Add**\n\n    3.  On the sheet, fill in the fields.\n\n<table id=\"id_w2q_ksz_gpb\"><thead><tr><th>\n\nField\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nName\n\n</td><td>\n\nName of the input variable that stores the input value.\n\n</td></tr><tr><td>\n\nType\n\n</td><td>\n\nType of data being passed to the topic block. For example, **String**, **Boolean**, and so on. The fields change according to your choice. For more information, see [Input data types in Virtual Agent topics](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/conversational-interfaces/virtual-agent/va-data-types.md).\n\n</td></tr><tr><td>\n\nRequired\n\n</td><td>\n\nOption to set the parameter as required.\n\n</td></tr><tr><td>\n\nHint\n\n</td><td>\n\nTooltip that is visible when authoring a calling topic. See the following example:\\[Omitted image \"va-topic-block-hint.png\"\\] Alt text: Input variable mapping tooltip in this example displaying \"Test Hint String.\"\n\n</td></tr><tr><td>\n\nTable\n\n</td><td>\n\nServiceNow table that is used to query for input.This field is available only when **Reference** or **Array.Reference** is selected from the **Type** field.\n\n</td></tr><tr><td>\n\nMax Number of Rows\n\n</td><td>\n\nMaximum number of rows that the topic block is allowed to define.This field is available only when **Array** is selected from the **Type** field.\n\n</td></tr><tr><td>\n\nDefault Value\n\n</td><td>\n\nDefault value for the variable. This value can be used when previewing the block.Duplicate default values are not allowed for array data types.\n\n</td></tr></tbody>\n</table>        For example, the pre-built Contextual Search topic block provides the following input parameters:\n\n        \\[Omitted image \"TopicBlockStartSegment.png\"\\] Alt text: Input parameters for the Contextual Search topic block include context, query, portal, and kb\\_knowledge\\_base.\n\n    4.  Select **Save**.\n\n    The calling topic or topic block passes input parameters to the topic block.\n\n7.  Drag Assistant Designer Asset library controls onto the canvas.\n\n    These controls include the input, bot responses, and utilities. Use them in combination to define the logic that is run in the topic block. For more information, see [Assistant Designer controls](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/conversational-interfaces/virtual-agent/virtual-agent-controls.md).\n\n8.  To define the output returned from the topic block, do the following:\n\n    1.  Select the **End** node in the canvas.\n\n    2.  In the End Segment Properties sheet, select **+ Add New**.\n\n    3.  On the sheet, fill in the following fields.\n\n        -   **Name**: Name of the value returned from the topic block.\n        -   **Value**: Either a string with variables or a script that can be used within the calling topic. The **Value** is presented as data pills. These are input variables that you defined \\(the **Default Value** specified in the Input Parameters and the input values from the node in the topic block\\).\n        For example, the pre-built Contextual Search topic block passes the following output parameters:\n\n        \\[Omitted image \"TopicBlockEndSegment.png\"\\] Alt text: Output parameters for the Contextual Search topic block include Results returned and Results Helpful.\n\n    4.  Select **Save**.\n\n    When the topic block finishes running in the calling topic, it can pass output variables to the calling topic.\n\n9.  To see how the topic block runs, select **Test**.\n\n    For example, the Contextual Search topic block returned the following results, including a preview-only message with the output values. The preview message helps you verify expected outputs and is not viewable to your users.\n\n    \\[Omitted image \"preview-topic-block.png\"\\] Alt text: The preview window displays the chat conversation and a preview only section that shows the output variables and their values. For example, \"results\\_helpful\":true.\n\n10. If you're ready to make the topic block available for use in calling topics, then do the following:\n\n    1.  Remove the default parameters that you used for testing.\n\n    2.  Select **Save**, and then select **Publish**.\n\n    The topic block state changes to Active and is ready for use in calling topics.\n\n\n## What to do next\n\n[Add a reusable topic block to a calling topic or topic block](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/conversational-interfaces/virtual-agent/add-topic-blocks-to-topic.md).\n\n"}}