DocsFlowCall Subflow

Call and Execute Subflow with Typed Parameters in RunMacro

Desktop ModeBrowser ModeRunMacro RunnerRunMacro 3.5+

Call Subflow executes a defined modular subflow within the macro project, binding typed input parameters and mapping returned output variables back to the caller.

Dialog & quick setup

RunMacro Call Subflow command configuration dialog showing parameter fields
Configuration dialog and parameter fields for the Call Subflow command in RunMacro.
  1. Create the target Subflow via the + Add Subflow tab or Subflow Interface editor in RunMacro.
  2. In your calling flow (Main or another Subflow), add the Control Flow › Call Subflow command.
  3. In Target Subflow, select the target subflow from the dropdown (recursive circular targets are automatically filtered out).
  4. In the Input Parameters table, enter literal values or bind caller variables (e.g., {username}, {row_id}).
  5. In the Output Return Mappings table, assign each subflow return output to a destination variable in the caller.
  6. Click Insert / Save to finalize.

Options reference

Target Subflow

Dropdown of callable subflows defined in the project. Circular recursion and self-call targets are strictly filtered out.

Input Parameters

Table displaying declared parameter names, data types (String, Number, Boolean, Array, Object), and input fields for literals or {var} caller bindings.

Output Return Mappings

Table displaying declared return values and destination variable selectors in caller scope. Setting (None) skips storing that output.

Modes & when to use

Desktop Mode

Executes desktop automation commands within the scoped subflow frame.

Browser Mode

Executes browser/CDP commands inside the subflow frame without disrupting the session.

RunMacro Runner

The runner seamlessly handles subflow frames and variable scope transitions.

Best for

  • Reusing repeated automation routines (such as logging in, solving captchas, audit logging, or formatting data) without copying commands.
  • Modularizing large, complex workflows into clean, isolated functional blocks that can be maintained and tested independently.
  • Executing parameterized functional procedures with typed inputs and returning structured outputs without polluting global variables.

Use an alternative when

  • Simple linear in-flow jumps without scoping needs.
  • Executing separate external macro files on disk.
  • Repeating a simple command sequence iteratively in place.
Before you run
  • At least one valid Subflow is created in the macro project via the Add Subflow tab.
  • The target subflow is not the calling flow itself and does not form a circular recursive cycle.
  • Caller source variables are initialized if dynamic values are bound to input parameters.

Example workflow

Example: Call "Login" Subflow with credentials and return status

  1. Define Subflow "Login" with inputs {user}, {pass} and output {is_logged_in}.
  2. In Main flow, add Call Subflow targeting "Login".
  3. Bind inputs: {user} = {current_account}, {pass} = {secure_password}.
  4. Map output: {is_logged_in} into variable {login_success}.
  5. Branch with IF condition: if {login_success} == true, proceed with workflow.

Example: Call data calculation subflow in batch processing

  1. Define Subflow "CalculateFee" taking {amount} (Number) and returning {fee} and {total}.
  2. Inside a data row loop, invoke Call Subflow with {amount} = {order_amount}.
  3. Map output {total} to {final_charge} to write to the invoice CSV.
  4. Verify the logged file output to confirm customer charges match expected fees.
Expected result: The target subflow runs through its commands returning control and output values to the caller.

Tips & limitations

Use clear, descriptive names for Subflows and their parameters (e.g. login_user, check_balance) to maintain clarity as project workflows expand.
If the target subflow has no declared inputs or outputs in its Subflow Interface, the tables will show empty states. Switch to that subflow tab and click "Subflow Interface" to configure them.
RunMacro enforces a maximum call depth of 32 frames (MAX_SUBFLOW_CALL_DEPTH = 32), shielding automation runs against accidental infinite recursion.
  • Maximum call depth is capped at 32 frames exceeding this threshold triggers a stack overflow error.
  • Local variables declared in a subflow exist only during its execution frame and cannot be accessed by the caller unless mapped via outputs.
  • Direct self-calls and mutual recursion cycles are strictly prohibited and blocked by the dialog and runner.
  • If the target subflow is deleted or renamed externally the command reports a missing target error.
  • Bound input types must match the target parameter specifications.
  • Only in-project subflows within the active pmacro file are callable external files require package commands.

Applies to RunMacro 3.5+ · Desktop Mode & Browser Mode & RunMacro Runner · Windows 10/11

RunMacro robot

Robots do the work. Your time is yours.

Create a robot in minutes, no coding needed. Reliable execution, remote management, transparent costs — and you always stay in control.