Workflow - Compare String equals with multiple condition

Hi, I have one workflow where I am comparing operator status with one value. Like Operator Compare Strings, value 1 $trigger.status comparison Operator → Equals → value 2 - Error… Here I want to include condition like comparison operator equals error or terminated or failed could you please suggest how can I write this mulitple equals condition. can I write something like (Error|terminated|Failed)

Here is an option:
Add 2 “Define Variable” type Operators (DVOs) before Compare Strings
image

Set one DVO as a Static string in the format |error|terminated|failed|
(let name of this DVO be: valuesToCheck)

Set second DVO as | CONCATENATE $trigger.status CONCATENATE |
Output of this DVO should look like |error| if the value of $trigger.status is error
(name of second DVO be: statusFound)

Now in the Compare Strings operator (CSO), set the operation as
$.defineVariable.valuesToCheck Contains $.defineVariable1.statusFound

Output of CSO true means status is one of the values in valuesToCheck.

Purpose of | being used as a separator in first DVO as well as marker @beginning and @end in the second DVO is to ensure that you don’t get a false true when the status value partially matches to any of the values in valuesToCheck.

Example: If status is active and valuesToCheck has inactive, CSO will return true when |s were not added to DVOs

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.