Flow Designer : Checking if value found in Arrary.String contains string

Dan Franko2
Kilo Contributor

I'm simply trying to check to see if a value, a string, is found in an array of strings. There's a couple ways to do this in javascript obviously, but I'm not sure how this is intended to work in flow designer. Regardless of what I've tried it always returns false.

 

find_real_file.png

3 REPLIES 3

Mohammed Lais1
Mega Guru

Hello Dan,

 

Try the "If" flow logic with condition as "{array} contains {string}". 

 

 

find_real_file.png

 

find_real_file.png

Hitoshi Ozawa
Giga Sage
Giga Sage

Flow Designer usually operates on records retrieved from ServiceNow tables. Not sure how the flow is setup and what is actually being compared. Usually, to test if a String value is contained in values from multiple records, "contains" is used.

However, the screenshot doesn't seems to be retrieved from a ServiceNow table.

To test if a string is included in an array, "includes" may be used in custom Action. Create an new Action with an array and string as input parameters. Add a "Script" step to test if an array includes a string. Return boolean True/False based on the result. Have an if statement based on the result of the Action.

example:

find_real_file.png

find_real_file.png

 find_real_file.png

 find_real_file.png

 find_real_file.png

find_real_file.png

find_real_file.png

I'm returning an array from an action I created, but I guess I can just check what I need inside the action itself.