Skip to content

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.

  1. Looks up the taskId task in the environment.
  2. If it’s open (pending or claimed), it closes it with status cancelled. The reason (reason) is stored as a comment and shows in the inbox and the audit log.
  3. 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.

ParameterTypeDefaultDescription
taskIdstring—Task id: the id output of Create Human Task. E.g.: task["id"].
ParameterTypeDefaultDescription
reasonstring—Why it’s cancelled (up to 1000 characters). Shown in the inbox and the audit log.

Returns an object (dictionary) with the task status after the call:

FieldTypeDescription
idstringTask id.
statusstringcancelled if it was cancelled now; if it was already closed, its status (completed, cancelled, expired).
titlestringTask title.
decisionstringcancelada if it was cancelled; if it was already decided, the chosen option.
commentstringThe cancellation reason, or the comment of whoever decided.
fieldsDictionaryFields the person filled in, if the task was already decided.
formDictionaryWith a form: its name and version. Without a form, null.
MessageCause 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: ”.

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: closing
If condition = closing["status"] == "completed"
└─ then:
Log level = info message = "Someone had already confirmed the address"