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

 

 

 

 

 

2 REPLIES 2

ifti122
Tera Guru

Hi jmiskey,

I see the issue. The problem is that Flow Designer's standard contains option isn't available for List Collector fields that use sys_choice as a data source. This happens because the field's value is stored as a comma-separated string, not as a list of references.

To handle this, the most reliable solution is to use a Script step in Flow Designer to check for the desired value.

 

Solution: Use a Script Step in Flow Designer

  1. Add a Script Action: Add a new Script action in your flow.

Write the Logic: Use the following example script to get the field value, split it into an array, and check if it contains your target choice.

// Get the comma-separated string value of the list collector field.
var selectedChoices = fd_data.trigger.current.[your_list_collector_field_name].toString();

// Convert the string into an array of values.
var choiceArray = selectedChoices.split(',');

// Check if the array of selected values includes your target value.
if (choiceArray.includes('your_choice_value')) {
    // If the value is found, perform your action
    // For example: fd_data.script.is_match = true;
}

This approach ensures your flow works correctly with sys_choice based List Collector fields, without needing to modify historical records.
Hope this helps!


Thanks & Regards,
Muhammad Iftikhar
If my response helped, please mark it as the accepted solution so others can benefit as well.

Thanks for the reply Muhammad!  I am away most of the next two days, but will definitely try to incorporate it when I get back to the office, and report back and let you know if I can get it to work.