Cancel Human Task
Cancel Human Task
Section titled “Cancel Human Task”Type: human-task-cancel · Package: Human Task Activities v1.3.3 · Output: object
Cancels a task that’s still open in the Zoan Cloud Tasks inbox. Use it when the process no longer needs the decision: the case was resolved another way, the customer withdrew, or the robot already found the data it was going to ask for. That way nobody wastes time deciding something that no longer matters.
How it works
Section titled “How it works”- Looks up the
taskIdtask in the environment. - If it’s open (
pendingorclaimed), it closes it with statuscancelled. The reason (reason) is stored as a comment and shows in the inbox and the audit log. - If the task was already closed (decided, cancelled or expired), it leaves it untouched and returns its current status. That makes it safe to call more than once.
A robot can only cancel tasks created by its execution, by another execution of the same process (for example, a retry cleaning up what the previous run left), or tasks linked to the queue item it’s processing. Tasks from other processes are rejected.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
taskId | string | — | Task id: the id output of Create Human Task. E.g.: task["id"]. |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
reason | string | — | Why it’s cancelled (up to 1000 characters). Shown in the inbox and the audit log. |
Output
Section titled “Output”Returns an object (dictionary) with the task status after the call:
| Field | Type | Description |
|---|---|---|
id | string | Task id. |
status | string | cancelled if it was cancelled now; if it was already closed, its status (completed, cancelled, expired). |
title | string | Task title. |
decision | string | cancelada if it was cancelled; if it was already decided, the chosen option. |
comment | string | The cancellation reason, or the comment of whoever decided. |
fields | Dictionary | Fields the person filled in, if the task was already decided. |
form | Dictionary | With a form: its name and version. Without a form, null. |
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
'taskId' is required. | taskId is missing. |
… HTTP 403: … (TASK_NOT_OWNED) | The task belongs to another process. Cancel it from that process or from the Tasks inbox. |
… HTTP 404: … (task not found) | The id isn’t valid, the task belongs to another environment or wasn’t created by a robot. |
Human task activities require a Zoan Automation runtime context. Missing: … | The process isn’t running from Zoan Cloud or from the Designer signed in. |
Errors arrive with the prefix “Could not cancel the human task: ”.
Example
Section titled “Example”The robot asks for a piece of data to be validated, but keeps looking for it on its own; if it finds it, it cancels the task:
Create Human Task title = "Confirm the delivery address for order #0001" data = { "Customer": "Test customer" } assignRole = "logistics" → output: task ... the robot checks another system and finds the address ...Cancel Human Task taskId = task["id"] reason = "The address was found in the order system" → output: closingIf condition = closing["status"] == "completed" └─ then: Log level = info message = "Someone had already confirmed the address"Related activities
Section titled “Related activities”- Create Human Task — create the task.
- Wait for Human Task — wait for the decision (it can cancel on its own when the time runs out).