DEV Community

Cover image for How do you show an Apex collection in a Screen Flow Data Table without a custom object?
Juan Manuel Garrido
Juan Manuel Garrido

Posted on Originally published at discover.egafutura.com

How do you show an Apex collection in a Screen Flow Data Table without a custom object?

Since Winter '26 (API 65.0 and later), the Screen Flow Data Table component accepts a collection of an Apex-defined type as its Source Collection. Pick a field as the new Unique Identifier and the table treats each item as a record: users can select rows and the flow can reuse them. Display and selection work today; inline editing does not yet.

I'm Juan Manuel Garrido, founder of EGA Futura, a native ERP built on Salesforce, and co-founder of Vantegrate, where we build AI agents for companies. Here is the practical walkthrough.

The old workaround

If you ever needed to display what an Apex action returned inside a Screen Flow, you probably did one of these:

  • Created a custom object that mirrored your Apex class, just to have something the Data Table would accept.
  • Inserted temporary records, displayed them, then deleted them.
  • Added a Transform element to convert the collection.
  • Built a custom Lightning Web Component.

All of these work. All of them leave extra pieces in the org that someone has to maintain.

Step 1: define the row type

Fields must be visible to Flow, so mark them with @AuraEnabled.

public class FxRate {
    @AuraEnabled public String currencyCode;
    @AuraEnabled public String currencyName;
    @AuraEnabled public Decimal buy;
    @AuraEnabled public Decimal sell;
}
Enter fullscreen mode Exit fullscreen mode

Step 2: return the collection from an invocable action

Invocable methods work on lists, one item per invocation, so wrap the collection in a result class.

public with sharing class GetFxRates {
    public class Result {
        @InvocableVariable(label='Rates')
        public List<FxRate> rates;
    }

    @InvocableMethod(label='Get FX Rates')
    public static List<Result> run() {
        Result r = new Result();
        r.rates = FxService.fetchRates(); // your callout or calculation
        return new List<Result>{ r };
    }
}
Enter fullscreen mode Exit fullscreen mode

Step 3: wire it in the flow

  1. In a Screen Flow, add an Apex action that calls Get FX Rates.
  2. Store the Rates output in a collection variable of Apex-defined type FxRate.
  3. Add a screen with a Data Table.
  4. Set Source Collection to that variable.
  5. Set Unique Identifier to currencyCode.
  6. Configure columns and the selection mode as you would for records.

The selected rows are exposed as output, so you can loop over them, pass them to another Apex action or summarize them on the next screen.

Picking a good Unique Identifier

  • It must be unique per row. Duplicates make selection ambiguous.
  • Prefer a stable key (a record Id, an ISO currency code, a business key) over free text.
  • If your source has no key, generate one in Apex while building the list.

What it does not do yet

Right now it is display and select. Inline cell editing for Apex-defined collections is still pending for a future release. If users need to edit values in the table, keep using separate inputs or a custom component for now. Also make sure the flow runs on API 65.0 or later.

Where it fits

  • Currency or stock quotes pulled from an external API.
  • Financial calculations resolved in Apex.
  • Batch results you do not want to persist in Salesforce.
  • Internal screens built in minutes, without extra objects.

Why I care about such a small change

At EGA Futura we build a native ERP for Salesforce, and our rule is to use what the platform already solves before adding layers on top. Every object you don't create is one you don't have to migrate, secure or explain to the next admin. If you want to see how we document these patterns, check the EGA Futura platform tutorials (in Spanish).

It's not the flashiest feature of the release, but it removes real friction between Apex and the UI. What would you build with it?

The original Spanish version, with an FAQ, is on EGA Futura Discover.

Top comments (0)