Skip to main content
MindStudio
Pricing
Blog About
My Workspace
Workflow Logic

Run Inline Script

The Run Inline Script block lets you write and execute TypeScript code directly inside a workflow step, without needing to define or reference a separate function entity.

Execute inline TypeScript code within your workflow

The Run Inline Script block lets you write and execute TypeScript code directly inside a workflow step, without needing to define or reference a separate function entity. The code is stored in the step configuration itself, and the block expects at least one entry file containing a named handler function that serves as the execution entry point.

The block accepts input variables mapped from the workflow context and uses the handler function's parameter names to resolve those mappings automatically. When the handler returns a plain object, each key in that object is written back as a workflow variable, making the return value the primary mechanism for passing data to downstream steps. You can also configure multiple files within the step and specify which file contains the handler.

This block fits into workflows where you need custom data transformation, conditional logic, or calculations that go beyond what built-in blocks provide. Because the script runs inline, it is well suited for lightweight processing tasks that need direct access to workflow variables without the overhead of managing a separate code resource.

What you can build

Real-world workflows powered by the Run Inline Script block.

Transform API Response Data

Parse and reshape a raw JSON payload returned from an HTTP request into a clean structure before passing it to downstream blocks.

Calculate Derived Values

Perform arithmetic or date calculations on workflow variables, such as computing a due date or a percentage score, and store the result as a new variable.

Validate and Sanitize Input

Check user-submitted form fields for required formats or constraints and return a validation status variable that controls branching logic.

Format Output for Display

Convert structured data into a formatted string or template before it is rendered in a response or passed to a messaging block.

Aggregate Multiple Variables

Combine several workflow variables into a single summary object, such as merging user profile fields into one record for downstream processing.

Conditional Routing Logic

Evaluate complex multi-condition logic that cannot be expressed in standard conditional blocks and return a routing key used to direct workflow flow.

Ready to add Run Inline Script to your workflow?

Get Started Free

Common questions about Run Inline Script

What are the required parameters for this block?

The block requires a files record containing at least one TypeScript file, an entryFile key identifying which file holds the handler function, and the handler function itself must be exported by name. Optionally, you can define inputVariables to map workflow variables into the script and outputVariables to control what gets written back.

What does the block return to the workflow?

The handler function must return a plain object. Each key in that returned object is set as a workflow variable, making those values available to subsequent steps in the workflow.

Do I need to create a separate function or resource to use this block?

No. The script code is stored directly in the step configuration, so no separate function entity needs to be created or referenced elsewhere in the project.

How are workflow variables passed into the script?

Parameter names in the handler function signature are automatically mapped to workflow variables. You can also explicitly configure inputVariables in the block to control which workflow variables are available inside the script.

What kinds of workflows commonly use this block?

This block is commonly used in workflows that require custom data transformation, input validation, arithmetic calculations, or conditional routing logic that goes beyond the capabilities of standard built-in blocks.

Add Run Inline Script to your workflow

Build powerful AI workflows with drag-and-drop blocks. No coding required.