Introduction
Run server-side JavaScript inside the ERP — workflows and batch processing.
VARIO Cloud is a cloud ERP system with a built-in scripting engine for server-side business logic automation. Scripts are written in JavaScript and executed in a sandboxed GraalJS runtime on the VARIO backend — no external servers, no middleware, no deployment pipelines. They can read, validate, transform, and write ERP records the moment an event occurs, with full transactional safety and zero network latency.
Every business eventually outgrows the standard feature set. An ERP that cannot be extended becomes a bottleneck. VARIO Cloud Scripting removes that bottleneck: any rule, automation, or integration you can express in JavaScript becomes a native part of the system — invisible to end users, auditable through logs, and versioned alongside your workflows. The scripting engine runs on the same Java backend that powers the REST API, and the full service layer is available to every script.
What You Can Do
With VARIO Cloud Scripting, you can automate any business process in the ERP:
Validate — enforce business rules before data is persisted, blocking saves that violate your constraints
Enrich — auto-fill fields, resolve references, and set defaults based on context when entities are created or modified
React — trigger follow-up actions in response to entity lifecycle events — create tasks, update related records, notify stakeholders
Orchestrate — pause execution to prompt users for decisions, then continue down the chosen path
Branch — route logic based on entity type, state, or any field value, applying different rules to different scenarios
Transform — convert documents between types, update statuses, and chain operations together automatically
Import — process CSV or JSON files row by row to create or update entities in bulk, with full field mapping and error handling per row
Two Scripting Contexts
VARIO Cloud provides two scripting contexts. Both share the same service layer — every service available in a workflow is also available in a batch script. The difference is how scripts are triggered and what data they receive.
Workflows
Event-driven scripts that react to entity lifecycle events — saving, creating, transferring, or editing records. A workflow consists of a trigger, one or more script elements, optional branching logic, and user interaction steps. Workflows are the primary mechanism for real-time automation.
Batch Processing
Data import scripts that process files row by row. Each row passes through a series of callbacks — beforeImport, eachRow, afterImport — giving you full control over how external data maps into VARIO entities. Batch scripts are designed for bulk operations like importing articles, customers, or suppliers from external systems. Imports can be scheduled to run automatically using Cron expressions, enabling fully unattended recurring data syncs.
Shared Service Layer
Both scripting contexts in VARIO Cloud access ERP functionality through ctx.services — a rich set of services for reading, creating, updating, and querying entities, resolving references, managing users, and logging.
Script Modules
Reusable JavaScript modules that can be imported by any workflow or batch script. Modules are managed centrally and organized into groups for structure and namespacing.
Getting Started
Open the Workflows section in VARIO Cloud
Create a new workflow and choose a trigger
Add a script element and write your first
setActionUse the built-in autocompletion to explore
ctx.availableInputandctx.servicesCheck the execution log after triggering the workflow
The script editor provides full autocompletion for all available services, methods, and entity properties — no guesswork required.
Type Definitions
The in-app script editor already offers autocompletion. When you develop scripts — especially Script Modules — locally in your own editor (for example VS Code), you can get the same IntelliSense and type checking from the @vario-software/types package. It ships type definitions for the scripting interfaces, including the ctx object, ctx.services, and entity DTOs. See the package page for setup instructions.
The same package also provides types for the REST API.
Last updated
Was this helpful?