You are here:
Collection Filter Element
Apply criteria to a collection, and then output a new collection that contains only the items that meet the criteria.
Required Editions
| Field | Description |
|---|---|
| Collection | The collection variable that is filtered. This field accepts any collection variable within the same flow. |
| Condition Requirements | Determines the logic that evaluates conditions.
|
| Condition Logic | Only appears if Condition Requirements is set to Custom Condition Logic Is Met. Enter logic such as 1 AND (2 OR 3). |
| Formula | Only appears if Condition Requirements is set to Formula Evaluates to True. Enter a formula that can evaluate to TRUE or FALSE, such as {!currentItemFromSourceCollection.Id} == {!varContactID}. |
| Field | The field evaluated by this condition. Doesn’t appear if Condition Requirements is set to Formula Evaluates to True. |
| Operator | The available operators depend on the data type of the selected Field. |
| Value | Field and Value in the same row must have compatible data types. Options: |
Usage
You can filter any collection found in Flow Builder, including collection variables that contain single values, collection variables that contain records, and Apex-defined collection variables.
Collection Filter outputs a collection with the filtered results and doesn’t change the contents of the source collection. The output collection is null until its corresponding Collection Filter runs.
- For example, if a Collection Filter element is named FilterLeads, its output collection is called Leads from FilterLeads.
- The Collection Filter element also creates a single variable called CurrentItem_FilterLeads. It acts as a loop variable for the Collection Filter element's input collection.
- You can reference the single variable in a formula resource. For example, you can create a Filter element formula condition where you set condition requirements to Formula Evaluate to True: AND ({currentItem_FilterLeads.LastViewedDate} < {!$Flow.CurrentDateTime,{!currentItem_FilterLeads.IsConverted})
If you filter your collection with a formula, the formula must evaluate to a boolean (true or false) value. For more formula considerations, see Flow Formula Considerations in Salesforce Help.
If you delete a Collection Filter element, the CurrentItem_FilterLeads variable remains in the flow. You can safely delete this single record variable after you remove the collection filter element.
Considerations for Defining Filter Criteria
-
When you define multiple filter criteria, the filter logic usually defaults to AND. But if multiple filters have the same field selected and use the equals operator, the filters are combined with OR.
For example, your filters check whether a case Type equals Problem, Type equals Feature Request, and Escalated equals true. At run time, the filters are combined to be
Type = (Problem OR Feature Request) AND Escalated = true. - The available filter operators depend on the data type of the selected fields. For details, see Flow Operators in Data Elements and Record Choice Sets.

