A Salesforce Flow Screen Component that enables reactive data retrieval directly within Screen Flows. Supports SOQL queries, SOSL searches, aggregate queries, and List View-based record retrieval via the Lightning UI API wire service.
- SOQL Queries — Execute dynamic SOQL queries with merge field support for Flow variables
- SOSL Searches — Perform full-text searches across one or two objects simultaneously
- Aggregate Queries — Run aggregate SOQL (COUNT, SUM, AVG, etc.) and return integer results
- List View Records (Wire Service) — Load records from existing List Views using
getListRecordsByName, with automatic column detection and pagination support - Reactive — Automatically re-fetches when input values change (configurable debounce for SOQL/SOSL)
- Flow-Native — Outputs strongly-typed SObject collections compatible with Flow's generic type system
- Data Cloud Support — Object picker includes Data Cloud objects (DMO, DLO)
Deploy the source to your org using Salesforce CLI:
sf project deploy start --source-dir force-appOr install via the managed package from AppExchange (Salesforce Labs).
Add the Data Fetcher component to any Screen Flow element. The Custom Property Editor (CPE) provides a guided configuration experience in Flow Builder.
- Select your target object
- Enter a SOQL query string (supports Flow merge fields like
{!varName}) - Access results via
retrievedRecords(collection) andfirstRetrievedRecord(single record) output variables
- Check "Use Wire Service (getListRecordsByName)"
- Select the target object
- Enter the List View API Name (e.g.,
AllAccounts,MyOpenOpportunities) - Optionally configure:
- Additional Fields — Extra fields beyond the list view's columns
- Page Size — Records per page (1–2000, default 50)
- Sort By — Override the list view's default sort
- Page Token — For pagination across multiple screens/loops
- Results output to the same
retrievedRecordsandfirstRetrievedRecordvariables - Use the
nextPageTokenoutput to paginate through large result sets
- Check "Show SOSL Configuration"
- Optionally select a second object
- Enter a SOSL search string
- Access results via
searchResultsandsearchResults1output variables
- Enter an aggregate SOQL query (e.g.,
SELECT COUNT(Id) FROM Account) - Access the result via
aggQueryResult(Integer output)
| Component | Purpose |
|---|---|
dataFetcher |
Main runtime component (invisible in Flow UI) |
dataFetcherCPE |
Custom Property Editor for Flow Builder configuration |
dataFetcherCPECombobox |
Flow-aware combobox supporting merge field selection |
dataFetcherCPEComboboxUtils |
Utility functions for combobox navigation |
dataFetcherObjectPicker |
Object selection component with search |
dataFetcherObjectPickerUtils |
Standard object options list |
| Class | Purpose |
|---|---|
DataFetcherController |
Executes SOQL, SOSL, and aggregate queries (USER_MODE) |
DataFetcherFieldSelectorController |
Retrieves object field metadata for the CPE |
DataFetcherObjectPickerController |
Retrieves objects, picklist values, and list views |
| Property | Type | Mode | Description |
|---|---|---|---|
queryString |
String | SOQL | The SOQL query to execute |
searchString |
String | SOSL | The SOSL search string |
aggQueryString |
String | Aggregate | The aggregate SOQL query |
objectName1 |
String | All | Primary object API name (default: Account) |
objectName2 |
String | SOSL | Secondary object for SOSL |
debounceTime |
String | SOQL/SOSL | Debounce delay in ms (default: 300) |
useWireService |
Boolean | Wire | Enable List View mode |
listViewApiName |
String | Wire | List View developer name |
fields |
String | Wire | Additional fields (comma-separated, optional) |
pageSize |
Integer | Wire | Records per page (default: 50) |
sortBy |
String | Wire | Sort override field(s) |
pageToken |
String | Wire | Pagination token |
| Property | Type | Description |
|---|---|---|
retrievedRecords |
SObject[] | Records from SOQL or List View |
firstRetrievedRecord |
SObject | First record from the result set |
error |
String | Error message if query fails |
aggQueryResult |
Integer | Result from aggregate query |
searchResults |
SObject[] | SOSL results (first object) |
searchResults1 |
SObject[] | SOSL results (second object) |
nextPageToken |
String | Token for next page (Wire mode) |
- All SOQL/SOSL queries execute in
USER_MODE, enforcing Field-Level Security (FLS) and object CRUD permissions - Wire service mode uses
optionalFieldsto gracefully handle field-level access differences across profiles - No data is exposed beyond what the running user has access to
- Salesforce CLI (
sf) - Node.js (for linting/testing)
npm install
sf org create scratch -f config/project-scratch-def.json -a data-fetcher-dev
sf project deploy start --source-dir force-app -o data-fetcher-devsf apex run test -o data-fetcher-dev --result-format humanThis project is licensed under the BSD 3-Clause License. See LICENSE for details.