Skip to content

Define Variable Operator

Beta feature

This operator is in Beta.

The Define Variable operator allows you to create dynamic values to use in the workflow. This allows users to combine existing values with static strings to create a custom variable.

Define Variable supports Concatenate Strings, Substring, Trim, Replace, Get Index, Add Time, and Subtract Time operators.

Each defined variable can have a maximum of 50 operations. Operations are executed in sequential order starting with the initial value of variable A.

Field Required? Description
Description No Add a description for your custom variable.
Name Yes Add a unique name for the custom variable. Create variable names in camel case without spaces.
Variable A Yes A JSONPath expression to a string value or date in the step's input, to be acted on with the chosen operator.
Operator Yes Select an operator to act on Variable A.

Choose an operator to act on Variable A. The operators you can use depend on the type of data selected for Variable A. Additional fields will appear based on your operator selection. The following operators are available:

Operator Description
Concatenate Strings Adds a static string to a variable. You must enter a static string in the Variable B field to be added to Variable A.
Substring Takes the inner portion of a string from Variable A. Select the number of the first character you want to use in the Starts From field. Select the number of characters in the segment you want in the Length field.
Trim Trims whitespace from the beginning and ending of input strings. Select the Prefix checkbox to remove whitespace from the beginning of the string. Select the Postfix checkbox to remove whitespace from the end of the string. You can select both.
Replace Finds patterns of characters and replaces them with alternate values. Enter the character patterns you want to find in the Pattern field. Enter the desired alternate values in the Replacement field.
Get Index Finds the location of a specific substring. Enter the substring into the Pattern field.
Add Time Adds a selected amount of time to Variable A when Variable A is a date. Select a number in the Length field. This is the number of your selected units. In the Unit field, select from Seconds, Minutes, Hours, Days, or Months. The transformed date cannot be more than a year from the original date.
Subtract Time Subtracts a selected amount of time to Variable A when Variable A is a date. Select a number in the Length field. This is the number of your selected units. In the Unit field, select from Seconds, Minutes, Hours, Days, Months, or Years. The transformed date cannot be before the current date.

For example:

If you configure a second custom variable called Email Address, you might make the following configurations:

  • Variable A is a JSONPath expression to a firstname attribute on an identity.
  • Operator 1 equals Substring.
  • Starts From equals 0.
  • Length equals 2.
  • Operator 2 equals Concatenate Strings.
  • Variable B is a JSONPath expression to a .lastname attribute on an identity.
  • Operator 3 equals Concatenate Strings.
  • Variable B is the static value @example.com.

The resulting custom variable will be fi.lastname@example.com and those attributes will be populated with the identity's data when the workflow is run.