Flow Designer Issue: IF Statements on List Collector Fields Using Choice List

jmiskey
Kilo Sage

We have a scoped app where a person fills out a Record Producer on the Service Portal, and it populates a record in a custom table.  That part works fine.  But we are creating a flow that does various things when the record is first added to the table, and are having issues creating an IF statement.  Basically, we have a List Collector field where the user can enter multiple values.  If a "certain" value is selected from that list, we would like the flow to update another field with some information it looks up. 

 

We have this working correctly on a few fields whose data source is another custom field.  However, we have a few instances in which the List Collector's data source is from the sys_choice table.  And we cannot get this one to work properly.  

 

First, here are what the key data elements in the sys_choice table look like:

jmiskey_0-1757355177162.png

(there are actually 17 in all, but these are just the first few)

 

And here is how the field in the Custom Table is set up (note the field type is "List"):

jmiskey_1-1757355401421.png

 

The field works properly - I am able to select multiple values to this field.

 

However, If I try to create an IF statement in a Flow based of this field, I do not get a "contains" option like I do for my List Collector fields which are pulling from custom tables.  This is what I see:

jmiskey_2-1757355572115.png

 

As you can see, there is no option for "contains".

 

I know I could probably create a custom table of all the options, and use that as the data source instead.  But there is already a lot of historical records out there, so to make those sort of changes would be problematic to the existing records.  So that is really not a good option in this case.

 

How can I get this to work, so my IF statement can look for one particular value among all the selected values for this field? 

 

Thanks

 

Thanks

 

 

 

 

 

1 ACCEPTED SOLUTION

OK, nothing was working, so I came at this in a different manner.  I had created another Custom Action a while back that converts List Collectors to Strings.  So I ran that against the table field.  Then when I tried to do an IF statement on that converted value, I had access to use CONTAINS, and accomplish what I need.

View solution in original post

12 REPLIES 12

(Note: I forgot to mention I did try true/false with and without the quotes around it in my script, and it did not make any difference).

 

Yeah, I noticed that too.  I am pulling the value right from the data field in my table.  It is set-up as shown in the second image on my original post (a List field, using the Choice table as its source).  Note the trigger for this Flow is "Data Sharing Record Created".

 

Here is where I am setting that value in my flow:

jmiskey_0-1757593324052.png

 

It is really odd, because if it was truly being treated as an Array/List and not a string, you think it would offer me the "Contains" option, and I wouldn't need my Custom Action.  But as I pointed it in my initial posting, that is not the case. 

@jmiskey 

then it's not getting passed as string to flow action.

You can skip the flow action entirely and simply check if the value you are passing contains in that list using Flow variable

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Thank is exactly the problem I am having, that is contained in my initial question - the CONTAINS options is NOT being made available to me in Flow Designer for this field!

 

Are you saying to set that table value equal to a Flow Variable, and use that in my comparison?  If so, what is the best Type should I choose for my Flow Variable that would give me the CONTAINS option?

@jmiskey 

yes please use Flow variable of type Boolean.

Then use "Set Flow Variables" flow logic and use script and set true/false in it

Then use this Flow variable in your IF logic

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

I am sorry, I am not understanding.  I do not see how that would help with the issue of the List Collector variable field type.  I thought you were saying store that in a Flow Variable to use in an IF statement to allow it to expose the CONTAINS option.  I do not see how using a Boolean Flow Variable solves that issue.