
A common limitation when working with Salesforce Flow is the inability to filter lookup results based on fields from related objects.
For example, say you need to filter Cases based on a field from the related Contact, such as showing only Cases where the Contact’s “Contact Type” is set to “VIP.”
In SOQL, this would be simple:
SELECT Id, Subject FROM Case WHERE Contact.Contact_Type__c = ‘VIP’
However, in Flow, standard lookup elements don’t support filtering based on related object fields.
Workaround 1: Using a Custom Formula Field
To achieve this, you can create a custom formula field on the child object (Case) that references the desired field on the parent object (Contact).
In this case, the formula field could pull the Contact Type value from the Contact.
This makes it possible to filter Cases in Flow based on the Contact Type using the formula field.
While this workaround can solve the problem, there are some downsides to consider:
- Formula Field Limitations: Using a formula field for this might create clutter in your object, especially if you need it for multiple lookups. It could be an unnecessary use of resources.
- Performance Concerns: Since formula fields are calculated in real time, adding too many can have a small impact on performance, particularly in more complex processes.
- Maintenance Overhead: Over time, managing these formula fields can become challenging, especially if your objects or fields change, potentially adding to your technical debt.
Step 1: Create a Custom Formula Field on the Case Object
- Create a formula field on the Case object named Contact Type with the formula:
Contact.Contact_Type__c
Step 2: Create the Screen Flow
- Create a new Screen Flow in Salesforce.
- Add a Get Records Element:
- Object: Case
- Filter: Use the formula field to filter by Contact Type equals “VIP”.
- Add a Screen Element:
- Configure a Data Table to display the Cases retrieved.
- Save and Activate the flow.

Step 3: Add Flow to the Account Record Page
- Go to Account Object in Object Manager.
- Edit the relevant Lightning Record Page.
- Drag the Flow component onto the page and select your flow.
- Save and Activate the page.
Workaround 2: Using a Collection Filter
A useful approach here is to first use the Get Records element to retrieve all Case records, and then apply a Collection Filter to filter the Cases based on the related Contact’s field (like “Contact Type”).
The Collection Filter component allows you to filter the results after retrieving all the records, effectively mimicking cross-object filtering within Flow.
Downsides of This Approach:
- Performance Concerns: Retrieving all records first, and then filtering them, could impact performance, especially when dealing with large datasets. Pulling all Cases into memory and applying a filter afterward is less efficient than a targeted query that retrieves only the relevant records.
- Higher Complexity: While this method avoids creating formula fields, it adds complexity to the Flow logic. The Get Records and Collection Filter elements must be carefully configured to ensure they work together correctly, which can make the Flow harder to maintain and troubleshoot.
- Flow Limits: Salesforce has governor limits for Flows, including the number of records that can be retrieved and processed in a single transaction. This approach can push those limits if the number of records is large, leading to errors or incomplete operations.
Step 1: Create the Screen Flow
- Create a new Screen Flow in Salesforce.
- Add a Get Records Element:
- Object: Case
- Retrieve all Cases.
- Add a Collection Filter Element:
- Filter using the formula:
- {!currentItem_Filter_VIP_Contacts.Contact.Contact_Type__c} = “VIP”
- Add a Screen Element:
- Configure a Data Table to display the filtered Cases.
- Save and Activate the flow.

Step 2: Add Flow to the Account Record Page
- Go to Account Object in Object Manager.
- Edit the relevant Lightning Record Page.
- Drag the Flow component onto the page and select your flow.
- Save and Activate the page.
It’s always a trade-off, but for now, this approach works well in scenarios where you need to filter records based on cross-object relationships.
I hope Salesforce enhances Flow’s lookup functionality soon to handle these use cases!
COMMENTS:
Leave a comment