# Task Cancellation

You can configure settings to define when and how to cancel a conversation task.

You can define task cancellation options at the top level of your task configuration file, to define global cancellation options. You can also define it in a task, a task requirement, and in a post-task conditional routing object. Values that you set in the requirement or routing objects override the settings at the task level, which override the global values.

## User Cancellation

The `user_cancel` property defines settings that allows users to cancel a conversation task, and what actions to take.

The following table describes the options that you can set in the `user_cancel` object.

Property | Type | Description
--- | --- | ---
`keywords` | array, strings | (Optional) A list of keywords that the user can type to cancel the task. When a user provides one of these keywords, Answer Server cancels the current conversation task, and runs the specified `action`. The default value is cancel. You can turn off user cancellation by setting keywords to an empty array. NOTE: Answer Server checks for cancellation terms before it performs response validation, so it cancels the task even if the cancellation keyword is also a valid response to the task requirement. Micro Focus recommends that you choose your response validation and cancellation keywords carefully to avoid a conflict. You can override global or task-level cancellation keywords by setting keywords in a requirement (or by setting the requirement keywords to an empty array).
`case_insensitive` | Boolean | (Optional) Set to false if you want to match the specified keywords case sensitively. The default value is true (not case sensitive).
`action` | object | (Optional) An object that defines the action to perform when the user cancels the task. You can set the following properties: `response` (string) Optional. The response to return when the task is canceled. You can include session and task variables. The default value is Task canceled. `routing` (string) Optional. The ID of the task to route to when the task is canceled. The default value is the configured `fallback_task` (see Default Tasks). `lua` (string) Optional. The name of a Lua function to run when the task is canceled. See Lua Processing Scripts. You can set this property to `null` to remove a Lua script that you configured at a more general level.

For example:

    {
       "user_cancel" : {
          "keywords" : [ "cancel", "end", "stop" ],
          "action" : {
             "response" : "Okay {{USER_NAME}}, we'll cancel that for now.",
             "routing" : "HELP"
          }
       }
    }

## System Cancellation

The `system_cancel` property defines settings that define what actions to take when the conversation task receives multiple non-valid responses.

NOTE: Any requirements that have `ask_options` configured ignore any system cancellation because in this case, Answer Server treats all non-valid responses as potential questions.

The following table describes the options that you can set in the `system_cancel` object.

Property | Type | Description
--- | --- | ---
`max_attempts` | number | (Optional) The number of non-valid input attempts that the user can make before the system cancels the task. The default value is 0 (no limit).
`action` | object | (Optional) An object that defines the action to perform when the system cancels the task after non-valid input. You can set the following properties: `response` (string) Optional. The response to return when the task is canceled. You can include session and task variables. The default value is Task aborted. `routing` (string) Optional. The ID of the task to route to when the task is canceled. The default value is the configured `fallback_task` (see Default Tasks). `lua` (string) Optional. The name of a Lua function to run when the task is canceled. See Lua Processing Scripts. You can set this property to `null` to remove a Lua script that you configured at a more general level.

For example:

    {
       "system_cancel" : {
          "max_attempts" : 5,
          "action" : {
             "response" : "I'm sorry, I still didn't understand that. Would you like to try again?",
             "lua" : "system_cancel"
          }
       }
    }

© Copyright 2015-2020 Micro Focus or one of its affiliates | Send documentation feedback Close Send documentation feedback To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a mail client, and then send this email to swpdl.idoldocsfeedback@microfocus.com. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_FT_HTML5_bannerTitle.htm