Built in conditions
CfFlow comes with a set of pre-built conditions that you may use in your workflow definitions. This page details the conditions available. For example, you may use the built-in state.Exists condition in your YAML workflow definition:
condition:
ref: state.Exists
args:
key: product_id
Conditions
- State conditions
- String conditions
- string.IsEmpty
- string.IsEqual
- string.IsEqualNoCase
- string.IsGreaterThan
- string.IsGreaterThanNoCase
- string.IsLessThan
- string.IsLessThanNoCase
- string.RegexMatch
- string.RegexMatchNoCase
- string.Contains
- string.ContainsNoCase
- string.StartsWith
- string.StartsWithNoCase
- string.EndsWith
- string.EndsWithNoCase
- Boolean conditions
- Numeric conditions
- Date conditions
State conditions
state.Exists
The state.Exists condition allows you to check for the existance a variable within the current state of a workflow.
Args
| Name | Description |
|---|---|
key | Required. The name of the variable to check the existance of. |
Example
condition:
ref: state.Exists
args:
key: product_id
String conditions
string.IsEmpty
The string.IsEmpty condition allows you to evaluate whether the given string value is empty or not.
Args
| Name | Description |
|---|---|
value | Required. The input value to check. Remember that you may use $var subsitution for state values |
Example
condition:
ref: string.IsEmpty
args:
value: $state_var
string.IsEqual
The string.IsEqual condition allows you to compare an input string against a pattern.
Args
| Name | Description |
|---|---|
pattern | Required. The pattern to match. Can be an array of string patterns or a String |
value | Required. The input value to match against the pattern. Remember that you may use $var subsitution for state values |
Example
condition:
ref: string.IsEqual
args:
pattern: test
value: $state_var
condition:
ref: string.IsEqual
args:
pattern:
- pattern_1
- pattern_2
- pattern_3
value: $state_var
string.IsEqualNoCase
The string.IsEqualNoCase condition allows you to compare an input string against a pattern.
Args
| Name | Description |
|---|---|
pattern | Required. The pattern to match. Can be an array of string patterns or a String |
value | Required. The input value to match against the pattern. Remember that you may use $var subsitution for state values |
Example
condition:
ref: string.IsEqualNoCase
args:
pattern: test
value: $state_var
condition:
ref: string.IsEqualNoCase
args:
pattern:
- pattern_1
- pattern_2
- pattern_3
value: $state_var
string.IsGreaterThan
The string.IsGreaterThan condition allows you to compare an input string against a pattern.
Args
| Name | Description |
|---|---|
pattern | Required. The pattern to match. Can be an array of string patterns or a String |
value | Required. The input value to match against the pattern. Remember that you may use $var subsitution for state values |
Example
condition:
ref: string.IsGreaterThan
args:
pattern: test
value: $state_var
condition:
ref: string.IsGreaterThan
args:
pattern:
- pattern_1
- pattern_2
- pattern_3
value: $state_var
string.IsGreaterThanNoCase
The string.IsGreaterThanNoCase condition allows you to compare an input string against a pattern.
Args
| Name | Description |
|---|---|
pattern | Required. The pattern to match. Can be an array of string patterns or a String |
value | Required. The input value to match against the pattern. Remember that you may use $var subsitution for state values |
Example
condition:
ref: string.IsGreaterThanNoCase
args:
pattern: test
value: $state_var
condition:
ref: string.IsGreaterThanNoCase
args:
pattern:
- pattern_1
- pattern_2
- pattern_3
value: $state_var
string.IsLessThan
The string.IsLessThan condition allows you to compare an input string against a pattern.
Args
| Name | Description |
|---|---|
pattern | Required. The pattern to match. Can be an array of string patterns or a String |
value | Required. The input value to match against the pattern. Remember that you may use $var subsitution for state values |
Example
condition:
ref: string.IsLessThan
args:
pattern: test
value: $state_var
condition:
ref: string.IsLessThan
args:
pattern:
- pattern_1
- pattern_2
- pattern_3
value: $state_var
string.IsLessThanNoCase
The string.IsLessThanNoCase condition allows you to compare an input string against a pattern.
Args
| Name | Description |
|---|---|
pattern | Required. The pattern to match. Can be an array of string patterns or a String |
value | Required. The input value to match against the pattern. Remember that you may use $var subsitution for state values |
Example
condition:
ref: string.IsLessThanNoCase
args:
pattern: test
value: $state_var
condition:
ref: string.IsLessThanNoCase
args:
pattern:
- pattern_1
- pattern_2
- pattern_3
value: $state_var
string.RegexMatch
The string.RegexMatch condition allows you to compare an input string against a pattern.
Args
| Name | Description |
|---|---|
pattern | Required. The pattern to match. Can be an array of string patterns or a String |
value | Required. The input value to match against the pattern. Remember that you may use $var subsitution for state values |
Example
condition:
ref: string.RegexMatch
args:
pattern: test
value: $state_var
condition:
ref: string.RegexMatch
args:
pattern:
- pattern_1
- pattern_2
- pattern_3
value: $state_var
string.RegexMatchNoCase
The string.RegexMatchNoCase condition allows you to compare an input string against a pattern.
Args
| Name | Description |
|---|---|
pattern | Required. The pattern to match. Can be an array of string patterns or a String |
value | Required. The input value to match against the pattern. Remember that you may use $var subsitution for state values |
Example
condition:
ref: string.RegexMatchNoCase
args:
pattern: test
value: $state_var
condition:
ref: string.RegexMatchNoCase
args:
pattern:
- pattern_1
- pattern_2
- pattern_3
value: $state_var
string.Contains
The string.Contains condition allows you to compare an input string against a pattern.
Args
| Name | Description |
|---|---|
pattern | Required. The pattern to match. Can be an array of string patterns or a String |
value | Required. The input value to match against the pattern. Remember that you may use $var subsitution for state values |
Example
condition:
ref: string.Contains
args:
pattern: test
value: $state_var
condition:
ref: string.Contains
args:
pattern:
- pattern_1
- pattern_2
- pattern_3
value: $state_var
string.ContainsNoCase
The string.ContainsNoCase condition allows you to compare an input string against a pattern.
Args
| Name | Description |
|---|---|
pattern | Required. The pattern to match. Can be an array of string patterns or a String |
value | Required. The input value to match against the pattern. Remember that you may use $var subsitution for state values |
Example
condition:
ref: string.ContainsNoCase
args:
pattern: test
value: $state_var
condition:
ref: string.ContainsNoCase
args:
pattern:
- pattern_1
- pattern_2
- pattern_3
value: $state_var
string.StartsWith
The string.StartsWith condition allows you to compare an input string against a pattern.
Args
| Name | Description |
|---|---|
pattern | Required. The pattern to match. Can be an array of string patterns or a String |
value | Required. The input value to match against the pattern. Remember that you may use $var subsitution for state values |
Example
condition:
ref: string.StartsWith
args:
pattern: test
value: $state_var
condition:
ref: string.StartsWith
args:
pattern:
- pattern_1
- pattern_2
- pattern_3
value: $state_var
string.StartsWithNoCase
The string.StartsWithNoCase condition allows you to compare an input string against a pattern.
Args
| Name | Description |
|---|---|
pattern | Required. The pattern to match. Can be an array of string patterns or a String |
value | Required. The input value to match against the pattern. Remember that you may use $var subsitution for state values |
Example
condition:
ref: string.StartsWithNoCase
args:
pattern: test
value: $state_var
condition:
ref: string.StartsWithNoCase
args:
pattern:
- pattern_1
- pattern_2
- pattern_3
value: $state_var
string.EndsWith
The string.EndsWith condition allows you to compare an input string against a pattern.
Args
| Name | Description |
|---|---|
pattern | Required. The pattern to match. Can be an array of string patterns or a String |
value | Required. The input value to match against the pattern. Remember that you may use $var subsitution for state values |
Example
condition:
ref: string.EndsWith
args:
pattern: test
value: $state_var
condition:
ref: string.EndsWith
args:
pattern:
- pattern_1
- pattern_2
- pattern_3
value: $state_var
string.EndsWithNoCase
The string.EndsWithNoCase condition allows you to compare an input string against a pattern.
Args
| Name | Description |
|---|---|
pattern | Required. The pattern to match. Can be an array of string patterns or a String |
value | Required. The input value to match against the pattern. Remember that you may use $var subsitution for state values |
Example
condition:
ref: string.EndsWithNoCase
args:
pattern: test
value: $state_var
```yaml
condition:
ref: string.EndsWithNoCase
args:
pattern:
- pattern_1
- pattern_2
- pattern_3
value: $state_var
Boolean conditions
bool.IsTrue
The bool.IsTrue condition allows you to evaluate whether a given value is true or not. The evaluation is a strict comparison and will only match when the value is true exactly.
Args
| Name | Description |
|---|---|
value | Required. The value to compare. |
Example
condition:
ref: bool.IsTrue
args:
value: $state_variable
bool.IsFalse
The bool.IsFalse condition allows you to evaluate whether a given value is true or not. The evaluation is a strict comparison and will only return false when the value is true exactly; it will return true in all other circumstances.
Args
| Name | Description |
|---|---|
value | Required. The value to compare. |
Example
condition:
ref: bool.IsFalse
args:
value: $state_variable
bool.IsTruthy
The bool.IsTruthy condition allows you to evaluate whether a given value is true or not. The comparison is a loose comparison that will treat non-zero numbers as true as well as the string, yes.
Args
| Name | Description |
|---|---|
value | Required. The value to compare. |
Example
condition:
ref: bool.IsTruthy
args:
value: $state_variable
bool.IsFalsey
The bool.IsFalsey condition allows you to evaluate whether a given value is true or not. The comparison is a loose comparison that will treat non-zero numbers as true as well as the string, yes. These values will all return false, anything not boolean or evaluating to false will return true.
Args
| Name | Description |
|---|---|
value | Required. The value to compare. |
Example
condition:
ref: bool.IsFalsey
args:
value: $state_variable
Numeric conditions
number.IsEqual
The number.IsEqual condition compares two numbers, a value against a match. It returns true if the numbers are equal.
Args
| Name | Description |
|---|---|
value | Required. The value to compare against the match value. |
match | Required. The value to compare against the value value. |
Example
condition:
ref: number.IsEqual
args:
value: $state_variable
match: 10
number.IsLessThan
The number.IsLessThan condition compares two numbers, a value against a match. It returns true if the value arg is less than the match arg.
Args
| Name | Description |
|---|---|
value | Required. The value to compare against the match value. |
match | Required. The value to compare against the value value. |
Example
condition:
ref: number.IsLessThan
args:
value: $state_variable
match: 10
number.IsLessThanOrEqualTo
The number.IsLessThanOrEqualTo condition compares two numbers, a value against a match. It returns true if the value arg is less or equal to the match arg.
Args
| Name | Description |
|---|---|
value | Required. The value to compare against the match value. |
match | Required. The value to compare against the value value. |
Example
condition:
ref: number.IsLessThanOrEqualTo
args:
value: $state_variable
match: 10
number.IsGreaterThan
The number.IsGreaterThan condition compares two numbers, a value against a match. It returns true if the value arg is greater than the match arg.
Args
| Name | Description |
|---|---|
value | Required. The value to compare against the match value. |
match | Required. The value to compare against the value value. |
Example
condition:
ref: number.IsGreaterThan
args:
value: $state_variable
match: 10
number.IsGreaterThanOrEqualTo
The number.IsGreaterThanOrEqualTo condition compares two numbers, a value against a match. It returns true if the value arg is greater than or equal to the match arg.
Args
| Name | Description |
|---|---|
value | Required. The value to compare against the match value. |
match | Required. The value to compare against the value value. |
Example
condition:
ref: number.IsGreaterThanOrEqualTo
args:
value: $state_variable
match: 10
number.IsWithin
The number.IsWithin condition compares two numbers, value and match and returns true if the difference between them is less than or equal to a given range.
Args
| Name | Description |
|---|---|
value | Required. The value to compare against the match value. |
match | Required. The value to compare against the value value. |
range | Required. The acceptable difference between match and value. |
Example
condition:
ref: number.IsWithin
args:
value: $state_variable
match: $another_state_variable
range: 5
Date conditions
date.IsFuture
The date.IsFuture condition allows you to validate whether the given date value is in the future. You may optionally provide an offset to offset the current date for the calculation.
Args
| Name | Description |
|---|---|
value | Required. The value to compare against the current date. |
offset | Optional. Offset the current date. Must be in CfFlow friendly date format. e.g. -2d, or 3w, or -18y |
Examples
condition:
ref: number.IsFuture
args:
value: $event_date
condition:
ref: number.IsFuture
args:
value: $date_of_birth
offset: -18y
date.IsPast
The date.IsPast condition allows you to validate whether the given date value is in the past. You may optionally provide an offset to offset the current date for the calculation.
Args
| Name | Description |
|---|---|
value | Required. The value to compare against the current date. |
offset | Optional. Offset the current date. Must be in CfFlow friendly date format. e.g. -2d, or 3w, or -18y |
Examples
condition:
ref: number.IsPast
args:
value: $event_date
condition:
ref: number.IsPast
args:
value: $date_of_birth
offset: -18y
date.IsToday
The date.IsToday condition allows you to validate whether the given date value is today. You may optionally provide an offset to offset the current date for the calculation.
Args
| Name | Description |
|---|---|
value | Required. The value to compare against the current date. |
offset | Optional. Offset the current date. Must be in CfFlow friendly date format. e.g. -2d, or 3w, or -18y |
Examples
condition:
ref: number.IsToday
args:
value: $event_date
condition:
ref: number.IsToday
args:
value: $event_date
offset: 5d
date.IsBefore
The date.IsBefore condition allows you to validate whether the given date value is before the given date match.
Args
| Name | Description |
|---|---|
value | Required. The value to compare against the match date. |
match | Required. The value to compare against the value date. |
Examples
condition:
ref: number.IsBefore
args:
value: $event_date
match: $booking_open_date
condition:
ref: number.IsBefore
args:
value: $dob
match: 2018-01-01
date.IsOnOrBefore
The date.IsOnOrBefore condition allows you to validate whether the given date value is on or before the given date match.
Args
| Name | Description |
|---|---|
value | Required. The value to compare against the match date. |
match | Required. The value to compare against the value date. |
Examples
condition:
ref: number.IsOnOrBefore
args:
value: $event_date
match: $booking_open_date
condition:
ref: number.IsOnOrBefore
args:
value: $dob
match: 2018-01-01
date.IsAfter
The date.IsAfter condition allows you to validate whether the given date value is after the given date match.
Args
| Name | Description |
|---|---|
value | Required. The value to compare against the match date. |
match | Required. The value to compare against the value date. |
Examples
condition:
ref: number.IsAfter
args:
value: $event_date
match: $booking_open_date
condition:
ref: number.IsAfter
args:
value: $dob
match: 2018-01-01
date.IsOnOrAfter
The date.IsOnOrAfter condition allows you to validate whether the given date value is on or after the given date match.
Args
| Name | Description |
|---|---|
value | Required. The value to compare against the match date. |
match | Required. The value to compare against the value date. |
Examples
condition:
ref: number.IsOnOrAfter
args:
value: $event_date
match: $booking_open_date
condition:
ref: number.IsOnOrAfter
args:
value: $dob
match: 2018-01-01
date.IsEqual
The date.IsEqual condition allows you to validate whether the given date value is exactly the same as the given date match.
Args
| Name | Description |
|---|---|
value | Required. The value to compare against the match date. |
match | Required. The value to compare against the value date. |
Examples
condition:
ref: number.IsEqual
args:
value: $event_date
match: $booking_open_date
condition:
ref: number.IsEqual
args:
value: $dob
match: 2018-01-01
date.IsSameDay
The date.IsSameDay condition allows you to validate whether the given date value is the same day as the given date match.
Args
| Name | Description |
|---|---|
value | Required. The value to compare against the match date. |
match | Required. The value to compare against the value date. |
Examples
condition:
ref: number.IsSameDay
args:
value: $event_date
match: $booking_open_date
condition:
ref: number.IsSameDay
args:
value: $dob
match: 2018-01-01
date.IsWithin
The date.IsWithin condition allows you to validate whether the given date value and the given date match are within a given range of each other.
Args
| Name | Description |
|---|---|
value | Required. The value to compare against the match date. |
match | Required. The value to compare against the value date. |
range | Required. Allowable difference between the dates. Must be in CfFlow friendly date format. e.g. 2d, or 3w, or 18y |
Examples
condition:
ref: number.IsWithin
args:
value: $event_date
match: 2020-12-25
range: 7d