Find Records
Use the Find Records step when your flow needs to read one or more records from a Business Central table. It lets you query any table, narrow results with field filters and a smart filter, and pass the matching records to later steps — for example to loop through them, check conditions, or print documents.
Typical use cases include:
- Fetching all open purchase orders for a specific vendor.
- Looking up a customer record by number before sending an email notification.
What happens when the step runs
- AutoFlow opens the table you configured.
- It applies all field filters to narrow the data set.
- It iterates through the filtered records. If you supplied a smart filter, each record is evaluated against it — only records where the smart filter resolves to true are included.
- Matching records are added as reference outputs (
results[0],results[1], …) up to the configured limit. - The
countoutput is set to the number of records found. - If no records match and Error on empty result is enabled, the step throws an error and the flow stops.
Configure the step
Open the flow editor, add Find Records, and fill in the configuration card.
Description
- Purpose: Summarise what this step fetches so the flow is easy to read.
- When to fill it: Always. The description appears in the editor and execution history.
- Tips: Include the table name and intent, for example "Fetch open purchase orders for vendor".
Table No.
- Purpose: Tells AutoFlow which Business Central table to query.
- When to fill it: Required. Without a table number the step cannot run.
- Tips: Use the lookup to browse available tables. Pick the actual application table — avoid temporary or buffer tables.
Field Filters
- Purpose: Restrict which records are returned before the smart filter runs.
- When to fill it: Optional, but recommended to avoid scanning the entire table.
- How it works: Each entry maps a field number to a Business Central filter expression. Filters are applied directly on the RecordRef, so they use native database filtering and are very efficient.
- Tips: Use dynamic values from previous steps by referencing variables with
{{variable}}syntax in the filter value. Combine multiple filters to create precise queries.
Smart Filter
- Purpose: Evaluate a condition per record using resolved field values.
- When to fill it: Optional. Use it when you need logic that goes beyond standard field filters — for example comparing fields from the current record against values from earlier steps.
- How it works: For each record that passes the field filters, AutoFlow injects the record's field values into the context and evaluates the smart filter expression. Only records where the expression resolves to true are included.
- Tips: Reference fields of the current record with
{{FieldName}}. You can also reference outputs from earlier steps. Leave this empty to skip per-record evaluation and accept all filtered records. See SmartFilters & SmartFormulas for the full operator and function reference.
Limit
- Purpose: Cap the maximum number of records returned.
- When to fill it: Optional. Defaults to 100 if left empty or set to zero.
- Tips: Set a reasonable limit for your scenario. If you expect a single record, set it to 1. For batch processing, raise the limit but keep performance in mind.
Error on empty result
- Purpose: Decide whether the step should fail when no records match.
- When to fill it: Optional. Disabled by default.
- Tips: Enable this when the flow cannot continue without data — for example when a required master record is missing. Leave it off when an empty result is a valid outcome that the flow handles downstream.
Outputs
The step returns two outputs you can use in later actions:
- count: The number of matching records found (as text).
- results: An array of record references (
results[0],results[1], …). Each entry is a record ID that subsequent steps can resolve — for example in a For Each Loop or a Create PDF Document step.
Working with results in a For Each Loop
Find Records pairs naturally with the For Each Loop step. Point the loop's selector at the results output to iterate over every found record. Inside the loop, each iteration exposes the current record reference, which you can use to read fields, run reports, or trigger further actions.
Best practices
- Filter early: Use field filters to narrow results at the database level before smart filters kick in. This keeps the step fast, even on large tables.
- Set a sensible limit: Avoid returning thousands of records unless you truly need them. A tight limit protects performance and keeps execution logs readable.
- Handle empty results: If an empty result set is possible, either enable Error on empty result or add a Decision step after Find Records that checks
count. - Combine with For Each Loop: When processing multiple records, pass
resultsinto a For Each Loop instead of hard-coding array indices. This keeps your flow dynamic regardless of the result count.