Skip to Content

Chain and control operations in Jitterbit Studio

Introduction

Studio provides two ways to chain operations together and control how they run: the Invoke Operation tool and the RunOperation function in a script. Both approaches create operation chains and support synchronous and asynchronous execution, but they suit different situations.

Invoke Operation tool Script with RunOperation
Setup Visual, drag-and-drop script step added to operation
Conditional logic Not supported Supported (use If, While, etc.)
Error capture Built-in error handling options Manual with GetLastError
Loops Not supported Supported
Best for Simple, unconditional invocations Controller logic, loops, conditional branching

Use the Invoke Operation tool

The Invoke Operation tool is a project component that runs a specified operation as a step within another operation. It is located in the Tools tab of the design component palette.

Add an Invoke Operation step

  1. In the design component palette, select the Tools tab.

  2. Drag an Invoke Operation tool onto the design canvas and drop it into the operation where the invocation should occur.

  3. The configuration screen opens automatically.

Configure the Invoke Operation tool

  • Name: Enter a name to identify this tool instance, or select Use operation name to match the name of the operation being invoked automatically.

  • Operation: Select the operation to invoke from the list of operations in the current project.

  • Run type: Select Synchronously or Asynchronously.

    • Synchronously (default): The invoked operation runs to completion before the parent operation continues. Global variable changes in the invoked operation are available in the parent.
    • Asynchronously: The invoked operation is queued and runs independently. The parent operation continues immediately without waiting. Global variable changes in the invoked operation are not reflected in the parent.

    For more information, see Synchronicity.

  • Error handling (synchronous only):

    • Raise error if operation fails: The parent operation fails and stops if the invoked operation fails. Any On Fail operation actions configured on the parent operation run.
    • Cancel operation chain if operation fails: The parent operation continues to completion, but no further On Fail or On Success actions run when it finishes.
  • Click Save Changes.

Note

An operation chain created using the Invoke Operation tool does not display a visual reference line on the design canvas.

Use scripts with RunOperation

For conditional invocation, loops, or error accumulation, add a script step to the operation and use RunOperation.

Basic invocation

<trans>
RunOperation("<TAG>operation:My Operation</TAG>");
</trans>

By default, RunOperation runs synchronously. Pass false as the second argument to run asynchronously:

<trans>
RunOperation("<TAG>operation:My Operation</TAG>", false);
</trans>

Conditional invocation and error capture

Wrap RunOperation in an If to detect failure and capture the error:

<trans>
If(!RunOperation("<TAG>operation:My Operation</TAG>"),
  WriteToOperationLog("Operation failed: " + GetLastError());
  RaiseError(GetLastError());
);
</trans>

GetLastError retrieves the error message from the most recently failed operation. RaiseError stops the current operation and triggers its configured On Fail action.

Controller scripts

A controller script is a script operation whose sole purpose is to coordinate other operations. It is useful when:

  • An operation must run conditionally based on project variables or data values.
  • Sub-operations are called from within a loop, passing data from a list to each invocation.
  • Trace logging is needed between operation steps (for example, WriteToOperationLog("Starting update at: " + Now())).

For a complete controller script example, see Manage workflows using controller scripts. For an automatic retry pattern, see Retry a failed operation.

Other uses of scripts

Scripts are also used within transformation field mappings and as stand-alone reusable scripts. If the same logic is needed in more than one transformation, create a stand-alone script and call it from each transformation using RunScript.