API Reference

There are two types of Workflow Rules available.

Conditional

Conditional Rules are responsible for guiding and constraining the path of a workflow execution according to predefined criteria. They look at provided input field values to make a decision based on a binary condition.

A conditional rule is composed of three parts:

  • The rule characterization which includes the rule name.
  • The condition defined by the field path, and the operator to use in order to compare incoming field inputs with the expected value.
  • The actions defined by the onTrueRuleName and onFalseRuleName, which depending on the condition outcome, will be used to invoke the next rule up on the set.

Constraints

  • A target field path must exist on the targeted workflow Scope as a required, queryable input.
  • Certain operators are exclusive to some data types. Check out Conditional Operators to find out more about all available operators and their constraints regarding field data types.
  • Both onTrueRuleName and onFalseRuleName must point to existing rules on the current workflow.
  • Conditional Rules may be freely placed anywhere in the set and in any order.

Example

This example has a condition on the field currency.code. In order to have a positive condition result, the incoming value of this field needs to belong to the currency array specified in value. In case the condition is met, Another Rule 1 will be invoked, and a negative result will cause Another Rule 2to be selected for execution.

{
      "type": "Conditional",
      "name": "Example",
      "path": "currency.code",
      "operator": "in",
      "value": ["EUR", "USD", "CHF"],
      "onTrueRuleName": "Another Rule 1",
      "onFalseRuleName": "Another Rule 2"
}

Assignment

Assignment rules are responsible for assigning values to output fields. Multiple output fields may be assigned in one single assignment rule.

An assignment rule is composed of two parts:

  • The rule characterization which includes the rule name.
  • The assignment(s) defined by the outputFields field, which is an array constituted by all field names and their respective values to assign.

Constraints

  • A target outputFields.outputField must exist on the targeted workflow Scope as a required output field.
  • The value to assign to the output field must comply with the data type defined in the scope for that field.
  • Assignment Rules are terminal rules, meaning that no other rule will be invoked after an assignment rule.
  • All possible paths on a workflow must end in an assignment rule.

Example

This example assigns two output field values.

{
      "type": "Assignment",
      "name": "Example",
      "outputFields": [
        {
          "outputFieldPath": "receiver.id",
          "outputFieldValue": 1
        },
        {
          "outputFieldPath": "receiver.name",
          "outputFieldValue": "Stripe"
        }
      ]
}