Script Actions

Using Script Actions

Script Actions allow you to write custom code to transform data, perform calculations, or implement custom logic. Moveworks currently supports a variation of Python called APIthon.

To provide a secure runtime, each Script Action adds non-negligible latency to your plugins. Please make sure to use DSL and our Data Mapper for common data transformation operations.

Option 1: Creating a standalone Script Action

You can create a standalone script action inside of the Plugin Workspace, under Actions > Script Actions. Once created, this action can be referenced inside of plugins through Action Activities.

Script Action Editor

The standalone Script Action editor includes:

  1. Language selector - Choose between APIthon (default) or Python (if enabled).
  2. Code editor - Write your script code here. Make sure to end the script with your return value.
  3. Input Args button - Opens the Input Arguments panel to define inputs for your script.
  4. Test button - Execute your script with the example values you defined.

Defining Input Arguments

Click the Input Args button to open the Input Arguments panel. Click Create New to add an argument with the following fields:

FieldRequiredDescription
Argument NameYesThe variable name to use in your script (e.g., customerName).
Data TypeYesThe type of the argument. See Data Types below.
List[T]NoCheck this box if the argument is a list of the selected data type.
Example ValueNoA test value used when clicking the Test button.
DescriptionNoDescribe the purpose of this input argument.
RequiredNoCheck if this argument must be provided when calling the action.

Click Save to save the argument.

Data Types

The following primitive data types are available for Script Action arguments:

TypeDescriptionExample Value
stringText valuesJohn Doe
integerWhole numbers123
numberDecimal numbers3.14
booleanTrue or falsetrue or false
arrayJSON array (mixed types allowed)[1, "two", true]
objectJSON object{"name": "John", "age": 30}

Using List[T] for Lists

Check the List[T] checkbox to indicate the argument is a list of the selected type. The example value must be a JSON array where each element matches the base type.

Data TypeWith List[T]Example Value
stringList[string]["apple", "banana", "cherry"]
integerList[integer][1, 2, 3, 4, 5]
objectList[object][{"id": 1}, {"id": 2}]
📘

Note

The array type accepts mixed types within the array, while List[T] enforces that all elements are of type T.

Option 2: Creating a Script Action inside a Compound Action

You can insert a script action directly inside a Compound Action using the script keyword.

YAML Fields for Compound Action Scripts

When adding a script inside a Compound Action, use the following YAML fields:

- script:
    output_key: result_variable
    input_args:
      arg_name: data.some_value
    code: |
      # Your APIthon code here
      return arg_name.upper()
FieldRequiredDescription
output_keyYesA variable name to store the result of the script.
input_argsNoA dictionary mapping argument names to values. Accepts Moveworks Data Mapping Syntax.
codeYesA string containing the code to execute.

Supported Languages

Moveworks currently supports a variation of Python called APIthon. This provides a familiar and powerful scripting environment for developers.

Follow our roadmap item to be the first to get full Python support in your instance.