Batch Processing
Process imported CSV or JSON data row by row, with full control over mapping and errors.
VARIO Cloud Batch Processing lets you run server-side JavaScript scripts that process imported data (CSV/JSON) row by row. Batch scripts are not limited to importing new records — they can also update existing entities in bulk, create related objects in mass, or combine both approaches. Since the full service layer is available, anything you can do in a workflow script can also be done per row in a batch script.
Script Structure
Every VARIO Cloud batch script starts with an import and registers one or more callbacks:
import batchAction from 'batch_script';
batchAction.setGuard((ctx) =>
{
// Return false to skip this row
return ctx.importData.ID !== '';
});
batchAction.setAction((ctx) =>
{
// Process a single row — return true on success, false on failure
const id = ctx.importData.ID;
// ...
return true;
});
batchAction.setAfterBatch((ctx) =>
{
// Runs once after all rows are processed
// ctx.importData is empty here — use ctx.importSession for accumulated data
});Callbacks
setGuard
Per row
boolean — false skips the row
Filter rows before processing
setAction
Per row
boolean — true = success, false = error
Process a single import row
setAfterBatch
Once after all rows, only if at least one row succeeded
—
Finalize the batch (e.g. trigger a print job)
The Context Object
Almost every callback in a VARIO Cloud batch script receives a context object ctx with the following properties:
ctx.importData
The current CSV/JSON row as a map. Keys are column headers.
ctx.importSession
A shared map that persists across all rows in a run. Use it to accumulate state.
ctx.services
Same services as in workflow scripts (vqlService, accountService, articleService, etc.)
ctx.parameters
Import parameters configured on the rule set
ctx.errorMessages
Accumulate error messages for the current row
Typical Pattern — Create or Update
Most VARIO Cloud batch scripts follow this pattern when importing data: check if the entity already exists via VQL, then create or update accordingly:
Logging
Use ctx.services.logger the same way as in workflow scripts:
Scheduled Execution
VARIO Cloud batch imports can be scheduled to run automatically using Cron expressions. Open a script processing and use the clock icon Automatisiert ausführen to create a scheduled processing, then set the Cron expression in System → Task-Manager and activate the task there (it is created inactive). The system triggers the processing at the defined intervals without manual interaction. Scheduling requires the workflow licence.
A scheduled processing reads its rows from one of two data sources:
Datei
A file stored in the DMS (CSV, JSON, TXT, XLSX, XML)
Recurring file imports
Abfrage
The records of a list selection, evaluated at every run
Nightly updates of matching records, e.g. "all customers", "articles without description"
There is no FTP, SFTP or URL source. To fetch data from an external system, call its API with the HTTP client inside the script. A selection that returns a single record works as a plain timer for such polling jobs, see Use Cases.
Files from an FTP or SFTP server can reach a script through VARIO Local Link. Local Link watches a local folder and uploads new files to the DMS automatically. Point it at a folder that receives the FTP files (for example a directory synchronised with the FTP server) and choose the DMS type Datenimport with a linked automated import. Every uploaded file is then added to that import, and your batch script processes it.
Last updated
Was this helpful?