Writing filter conditions is a core admin and developer skill. The same patterns apply across List Views, Reports, Flows, and SOQL; learn them once and reuse everywhere.
- Identify the records to narrow
Decide which object and what subset matters: Open Opportunities, Closed Cases this month, Leads with no recent activity. The business question drives the filter.
- Pick the fields and operators
Map the business question to fields and operators: Status = Open, ClosedDate = LAST_MONTH, Last_Activity_Date_c older than 90 days. Operators must match the field type.
- Build the conditions in the right tool
For List Views: open the view, click Edit Filters. For Reports: filter pane. For Flows: condition editor. For SOQL: WHERE clause. The syntax differs slightly but the logic is the same.
- Combine with AND/OR logic
Most filters AND conditions together (all must be true). Use OR when any of several conditions counts. Use custom logic with numbered conditions and parentheses for nested logic: (1 AND 2) OR (3 AND 4).
- Test with sample data
Run the filter and confirm it returns the expected records. Edge cases (null values, special characters) often surface here.
- Optimize for performance
Filter on indexed fields when possible (Id, lookup fields, Unique, External Id, fields with custom indexes). Avoid leading wildcards (LIKE %text%); the platform cannot use indexes.
Exact value comparison.
Numeric and date comparison.
Substring matching for text fields.
Multi-value match.
TODAY, LAST_WEEK, LAST_N_DAYS, THIS_QUARTER, and so on.
Direct value matching for booleans and picklists.
- Null handling varies by context. Some filters treat null as not equal; others may fail to match expected behavior. Test null cases explicitly.
- Leading wildcards in text filters disable indexing. Filters like Name LIKE %customer% scan every row; performance degrades on large tables.
- Date literal semantics differ across tools. TODAY in SOQL is the running user''s timezone; TODAY in formula functions is the org''s timezone. Mismatches cause subtle bugs.
- Complex custom logic (1 AND 2 OR 3 AND 4) without parentheses can be ambiguous. Use parentheses explicitly to make precedence clear.