Skip to main content
Version: 1

Filter SObjects

  • Category

    • Data
    • Filter
    • Records
  • Flow Icon

Overview

The Filter SObjects component filters a collection of Salesforce records by a specified field and value, and returns at most one matching record.

Unlike the standard Salesforce Flow Filter Collection feature, which outputs a collection and often requires a Loop to process records, this component returns a single record or null.
This significantly simplifies Flows and improves performance by eliminating the need for looping when you only need one match.


Inputs

  1. records (Required)
    A collection of SObjects to filter (e.g., Accounts, Opportunities, or custom object records).

  2. fieldName (Required)
    The API Name of the field to filter by (e.g., StageName, Status__c).

  3. fieldValue (Required)
    The value to match against the specified field.

    • Comparison is done as a string equality check.
    • Null values are ignored.

Outputs

  1. success
    A Boolean indicating whether any record matched the criteria.

  2. filteredRecord
    The first record in the input collection that matched fieldName = fieldValue.

    • If no match is found, this is null.

Example Scenario – Select First Closed Opportunity

Scenario:
You have a collection of Opportunity records in Flow and need to retrieve a single Opportunity where StageName = Closed Won. With standard Flow, you’d need to Filter Collection and then Loop to grab the first match.

Implementation with Filter SObjects:

  1. Input

    • records = Opportunity collection
    • fieldName = StageName
    • fieldValue = Closed Won
  2. Execution
    The component evaluates the records in the collection.

  3. Output

    • success = true if a Closed Won record exists
    • filteredRecord = the first Opportunity with StageName = Closed Won

Results

  • Simplifies Flow design by returning 1 record or null directly.
  • Saves Flow elements and removes the need for a Loop just to pick one item.
  • Provides a clean Boolean (success) to easily branch logic (e.g., Decision element).

Best Practices

  • Ensure the fieldName matches the API name exactly (case-sensitive).
  • Use this action when you only need one record. If you need multiple matches, use standard Flow collection filters.
  • Be aware that comparison is string-based — ensure values are formatted consistently (e.g., date fields should be in the same string format).


Troubleshooting

  • No match found: success = false, filteredRecord = null.
  • Typo in field name: The component won’t find matches — confirm API names in Object Manager.
  • Value mismatch: Check for exact string match; consider trimming spaces or consistent casing in Flow variables.