Skip to content

Scripting ​

Most of a flow is configured, not coded. When a step needs logic no plugin offers - a calculation, a rule, a format of your own - put a script component there and write that step in C#, Python or JavaScript. The rest of the flow stays visual.

How a script component works ​

A script component receives each record on its Input pin, runs your code, and sends records on with Next. Your code gets three things:

  • the record, as an object of its flow type with real properties (inputData.Email),
  • the metadata of the message, which you pass on with the records you send,
  • the flow services (Services in C#, services in Python and JavaScript): logging, settings, storage, assets, batches and more, under the same names in all three languages. See Flow services.

Call Next once to pass one record on, several times to split a record into many, or not at all to drop it. When the component's Output has no connection, pass the input on. Every flow type is available as a class, so you create output records with new CustomerDto() (C#, JavaScript) or CustomerDto() (Python).

An exception stops the record and goes to the flow's error handling, like an error in any other component.

Choose a language ​

C#PythonJavaScript
Runs asCompiled into the flow's assemblyCPython 3.11+ embedded in the hostV8 embedded in the host
SpeedFastest; compiled codeInterpretedJIT-compiled
LibrariesNuGet packages added to the flowpip packages installed in the host's PythonBuilt-ins, fetch, timers; no modules
MessagesIn parallel (or one instance per message)One at a time per componentOne at a time per component
EditorCompletion, hover and live compile errorsSyntax highlighting; full completion in your own IDE with the viaducta packageSyntax check
DebuggerBreakpoints and steppingLine tracing with local variablesBreakpoints, stepping, variables

Use C# for throughput and for anything that needs .NET libraries. Use Python when your team writes Python or needs a Python package. Use JavaScript for light transformations and HTTP calls with fetch.

Pages ​

Viaducta documentation