Create ZIP Archive
The Create ZIP archive step packs any number of files into one ZIP archive. The archive becomes a document in the AutoFlow document library, so later steps can use it like the document of a Create PDF Document step: attach it in Send Email, upload it with Azure Blob Storage, return it from a webhook, or store it as an incoming document attachment with Insert Record.
Typical use cases:
- Send all attachments of an incoming document to an auditor as one ZIP file.
- Collect the PDFs of several posted invoices and upload them as a single archive.
- Bundle an XML file returned by an HTTP request together with its PDF.
Archive name
The file name of the archive, e.g. Invoices {{workdate}}.zip. If the name does not end in .zip, it is added. Leave the field empty for archive.zip.
Files
Each row adds one or more files. Pick its Type first – it decides which of the other columns you fill:
| Type | Reference | Content (base64) | File name |
|---|---|---|---|
| AutoFlow document | A document from an earlier step, e.g. {{pdf_Document}} | – | Optional |
| Incoming document attachment | An incoming document attachment, e.g. {{find_results}} | – | Optional |
| Base64 | – | The content as base64, or a binary output such as {{http_responseBody}} | Required |
A Reference may point at one record or at many: the results of a Find Records step, a collection from Create Collection or a loop variable. Every record becomes its own file in the archive. A reference that points at a record of a different table – an incoming document attachment in an AutoFlow document row, for example – stops the step with an error.
Files from references keep their own names: the document's name, or the attachment's name with its file extension (Scan 0815.pdf). Fill File name to use a different name. When the reference points at several records, SmartFields in File name that start with the reference itself are filled in for each record: with the reference {{find_results}}, the file name {{find_results.Document No.}}.pdf gives every file the number of its own record.
Base64 content is decoded before it goes into the archive. A single SmartField that already holds binary data – the response body of an HTTP Request, for example – is taken as it is. Content that is not valid base64 stops the step with an error that names the file.
Folders inside the archive
File name may contain folders: invoices/2026/INV-1001.pdf puts the file into the folder 2026 inside invoices. SmartFields work here too, e.g. {{vendor_name}}/{{doc_name}}.pdf.
A file name that ends with a slash names a folder only. scans/ on a row that references the results of a Find Records step puts every attachment into the folder scans, each under its own name.
Folder parts that would lead outside the archive – .., a leading / or a drive letter such as C: – are left out, so ../../report.pdf becomes report.pdf. A slash inside a document's own name never creates a folder; it is replaced by _.
Files with the same name
If two files would end up with the same name in the same folder, the later ones are numbered: invoice.pdf, invoice (2).pdf, invoice (3).pdf. Upper and lower case count as the same. Files with the same name in different folders keep their names.
Error if empty
On by default: if no row yields a file – for example because the Find Records step found nothing – the step stops the flow with an error. Switch it off to let the flow continue instead. The step then creates no archive, and its output created is false, so a Decision step can take a different path.
Outputs
| Output | Content |
|---|---|
created | true when an archive was created, false when there was nothing to pack and Error if empty is off. |
Document | The ZIP archive in the AutoFlow document library (content type application/zip). |
name | The file name of the archive. |
size | The size of the archive in bytes. |
fileCount | The number of files in the archive. |
Example: send all attachments of an incoming document
- Find Records on Incoming Document Attachment, filtered on the incoming document's entry number. Slug
find. - Create ZIP archive with one row: Type Incoming document attachment, Reference
{{find_results}}. Archive name{{trigger_record.Document No.}}.zip. - Send Email with the archive's
Documentas the attachment.
Things to keep in mind
- The archive is built in memory. Archives of a few megabytes are no problem; very large ones (hundreds of megabytes) can run into the limits of the Business Central server.
- Every archive is a new document in the AutoFlow document library. Use Delete Record on the
Documentif you don't need to keep it after it was sent or uploaded.