Given a list, the Filter Custom function creates a new list that contains only those items in the list that pass a test. The test is done by calling a child Flow once for each item. The Flow returns true or false, as to whether that item should be included in the output list. (To filter using a simple comparison test, use the Filter function instead.)
To use this function, first build the child Flow that you will use to test each item. This child Flow will be invoked once for each item in the list. Define fields on the event card that will be the inputs that feed into the test. Typically you will include a field for the item of the list, i.e. if the list is a list of text then one of the inputs should be text. You can also include other inputs, whatever your Flow will need to perform the test. Then build the rest of the child Flow, ending with a Return card that returns a single value of the true/false type – either True (to include that item in the resulting list) or False (to not include it). The name of the true/false field on the Return card doesn’t matter. Save the Flow and turn it on.
Now go back to the Filter Custom card and select the Flow you just built. The inputs will auto-populate, then you can map data into them. To map an input to accept each item of the list, click in that field and you will see a dropdown that includes Item - select that. Or if your list is a list of objects, you may also see the schema of the object, i.e. the keys that it contains, and you can also build your child Flow to accept those as inputs. In addition, you can drag in outputs from previous cards in the Flow - in that case, the same value will be used for each item in this list.
Input Fields
- list: The input list that contains all of the items you will test
- flow: The child Flow that will be called once for each item in the list
- with the following values (dynamically generated): The inputs defined by the child Flow - these will populate after you select the child Flow using the Choose Flow dialog
- concurrency: The number of items in the list to process in parallel. If it is important that the items are processed in sequence, use 1. Otherwise a higher number like 5 or 10 will cause your Flow to complete sooner.
Output Fields
- list: The output list that contains only those items that passed the test, as determined by the provided child Flow.