Download Human Task File
Download Human Task File
Section titled “Download Human Task File”Type: human-task-download-file · Package: Human Task Activities v1.3.3 · Output: List<string>
Since: v1.3.0
Brings the files of an answer to your machine: the scanned invoice, the receipt for an advance, the photos of an inspection. When the person answers a task with a form that asks for attachments, the robot only receives each file’s reference in fields ({id, name, …}); with this activity it downloads them to keep working with them (upload them to the ERP, read them with OCR, archive them).
How it works
Section titled “How it works”- Looks up the
taskIdtask in the environment where the execution runs. The task must be closed (decided, expired or cancelled): if it’s still pending or claimed, the activity fails. - Chooses which files to download:
- Without
fieldorfile: every file in the answer. - With
field: only the files in that field. For a file column inside a table, usetable.column(for example,expenses.receipt); with justtable, it brings the files from all its columns. - With
file: only the ones you specify, as they arrived infields(a file, a list of files or theid). If you passfilebut it’s empty, nothing is downloaded.
- Without
- Saves them in
destinationwith their original name, sanitized for Windows (no paths or invalid characters). If two files have the same name, the second one becomesname (2).ext. A file that already exists with that name in the folder is replaced. - Returns the list of local paths, in the order they were downloaded.
Only files that are part of that task’s answer are downloaded (not the attachments the robot added when creating it). Every download is recorded in the audit log as a file read by the robot.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
taskId | string | — | Task id (the id returned by Create Human Task). |
destination | string | — | Folder where the files are saved (created if missing). If a single file is downloaded and destination has an extension, doesn’t end in \ and isn’t an existing folder, it’s used as the full file path (e.g. C:\out\receipt.pdf). |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
field | string | — | Key of the form’s file field, or table.column for a column of a table. Empty = every file. |
file | object | — | A file ({id, …}), a list of them or an id, taken from fields. Set but empty = nothing is downloaded. Can be combined with field. |
Output
Section titled “Output”Returns a List<string> with the full local path of each downloaded file. If the answer has no files (or none in field), or if file was empty, the list is empty: that’s not an error.
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
'taskId' is required. / 'destination' is required. | A required parameter is missing. |
The task has no answer yet: wait until it is decided (for example, with «Wait for Human Task»). | The task is still pending or claimed. Wait for the decision before downloading. |
'file' must be a file from the answer ({ id, name, … }), a list of them or the file id. | file doesn’t have a valid shape (for example, a dictionary without id). |
File … is not in the task answer. / … (field «…»). | You asked in file for a file that isn’t part of that answer, or isn’t in field. |
Zoan Cloud did not return the file download link. / The download failed: HTTP …. | The download failed. Retry with Retry. |
… HTTP 404: … (task not found) | The id isn’t valid or the task belongs to another environment. |
Human task activities require a Zoan Automation runtime context. Missing: … | The process isn’t running from Zoan Cloud or from the Designer signed in. |
Communication errors arrive with the prefix “Could not download the task files: ”.
Example
Section titled “Example”Download the receipts of an advance request that has already been decided and loop over them:
Wait for Human Task taskId = task["id"] → output: resultIf condition = result["decision"] == "Approve" └─ then: Download Human Task File taskId = task["id"] field = "receipt" destination = "C:\Advances\" + str(result["id"]) → output: files For Each items = files itemVariable = path └─ activities: Log level = info message = "Receipt downloaded: " + pathfiles holds the path of each receipt, ready to loop over with For Each.
Related activities
Section titled “Related activities”- Create Human Task — create the task with a form.
- Wait for Human Task — wait for the answer before downloading.