Workflow : Compare string Operator - Contains

Hello Team,

I am using workflow action as “Get Account” and the get account is returning the accounts related to specific identity after that I am validating that the user having "demo " account or not, to validate that I am using “Compare String Operator Contains method” (Below are the values for compare string)

Value 1 = $.getAccount.accounts[*].sourceName - [“demo”,“demo1”,“demo2”]

operator = contains

Value2 demo

but the condition always goes to false even if the array contains “demo”.

@colin_mckibben can you suggest anything?

Thanks,
Prasad

Hi Prasad,

The “Compare String” operator is for comparing two string values. In your example you are attempting to compare a list with a string, which is why you are always getting false. In this case, you won’t be able to use “Compare Strings” to achieve your goal. Instead, try using the “Verify Data Type” operator with a slightly different JSONpath filter, as shown in the following image.

This will work as long as you are trying to match an account that has the exact name “demo”. For example, if your account list is [“demo”,“demo1”,“active directory”], it will return true. If your account list is [“demo1”,“active directory”], it will return false because there is no account with the exact name “demo”.

1 Like

Thanks for posting this, exactly what we also were looking for!

1 Like