Articles in this section

Configure branch conditions

Branch conditions decide which records flow through each branch of a branching. You configure conditions in the Add branching or Edit branching dialog, using either rules or a JavaScript function. The dialog and the steps in this article are the same in Flow builder, API builder, and Tool builder.

Prerequisites: Manage permission, Administrator role, or account owner — You must have the Manage permission on the integration, the Administrator role on the account, or own the account. For details, see Manage user roles & permissions to an account.

Choose a conditions format

Use the Rules and JavaScript toggle in the dialog to choose a format. Rules is the default. Rules suit conditions you can build from fields, values, and operators. JavaScript suits logic that rules can't express, and requires a script that contains a branching function.

If you define no conditions for a branch, all records that reach it flow through it.

Configure conditions with rules

Only records that meet a branch's conditions flow through it.

  1. In the branch, select + Condition.
  2. For the left operand, choose a data type, an operand type, and a field:
    1. Select the data type: String (default), Number, Boolean, or Date Time.
    2. Select the operand type: Field (default), Hard-coded value, or Expression.
    3. Type or select a field.
  3. Select an operator: equals, not equals, is greater than, is greater than or equals, is less than, is less than or equals, starts with, ends with, contains, does not contain, is empty, is not empty, or matches. A condition without an operator shows the error "Please select an operator."
  4. For the right operand, choose a data type and an operand type, and then enter or select a value. The default operand type is Hard-coded value.
  5. To add another condition to the branch, select + Condition. Use Condition operator to choose AND or OR for how the conditions combine.
  6. To combine conditions in a set, select Add group. A group has its own NOT checkbox and can contain conditions and other groups.
  7. Select Preview to check the output, and then select Save & close.

Rule controls

  • NOT — Matches records that don't meet the condition or group. It's available on each condition and group.
  • Data type — Sets the type of the operand: String, Number, Boolean, or Date Time.
  • Operand type — Sets what the operand is: Field (a field from the input record), Hard-coded value (a value you enter), or Expression (a value you write as a Handlebars expression in the Expression box, which has a Handlebars button ({})).
  • Lowercase, Uppercase — Apply a function to the operand. These options appear in the operand type menu when the operand type is Field.
  • Condition operator — Chooses AND or OR to combine conditions.
  • Add group — Adds a group of conditions that you can combine with other conditions. For example, use one group with NOT to exclude records created before a date, and another group with AND or OR to include other records.

Manage conditions

  • Select the arrow next to a branch name to collapse or expand its conditions.
  • Drag the handle on a condition or group to move it.
  • To add a condition after an existing one, select the plus sign (+) on the condition row.
  • To copy or remove a condition, select the overflow menu elipses-button.png on the condition row, and then select Clone condition or Delete condition. A group has clone and delete icons.
  • To remove all conditions from a branch, select the Actions elipses-button.png menu at the end of the branch header, and then select Clear all conditions.

If a field doesn't appear

If a field you want to use doesn't appear in the field list, your mock output record doesn't meet the existing filter or branching conditions. Update the mock output record so it meets them, and the field appears.

Use array data

You can use fields from array data in branch rules. In the field list, you can:

  • Select the child records at the first index of an array.
  • Select records from a primitive data type array.
  • For an object array, enter the complete array path in the field box to reach records from the second index onward.

Configure conditions with JavaScript

Before you start, create a script that includes a branching function.

  1. In the dialog, select JavaScript.
  2. In Branch conditions script, select a script that includes a branching function from Script. The script appears in the editor.
  3. In Function, confirm the function name is branching, which is the default. If your script uses a different function name, enter it.
  4. Select Preview to check the function output, and then select Save & close.

To add a script, select the plus sign (+) next to Function. To reset a script, select Reset script.