How to use Apex Defined Types as Source in the Data Table?
Hola! 🙂
If you have used the new standard Data Table flow screen component, you might have noticed that the current version Data Table component doesn’t support collection of Apex Defined Types.
A typical use case for this is when you’re receiving data from an external system by doing a callout and want to surface this data in a tabular format to your users.
I’ve found a workaround that get’s the job work, it’s not pretty though. So if you’re in dire need of a quick solution, you’re in luck. 🙂
Concept
The idea is to create and use a Custom Metadata Type that has the exact schema (in other words, data model) as the data you’re receiving from the external system.
After you receive the data from the callout, you can loop on the collection of Apex Defined Type and use Assignment element to create and copy the data in custom metadata type variable which is then added to a collection variable of the same custom metadata type. And finally, you can use the collection variable of the custom metadata type as the source in your Data Table component.
Example Flow
An example flow would look (roughly) like this.

NOTE: Again, I’d like to emphasize, this is not pretty but you can use this as a temporary workaround. Or if you have Eric Smith’s datatable installed, you can use that because that supports Apex Defined Types as a data source. Hopefully (soon), Salesforce adds the support for Apex Defined Types for the standard Data Table component. I believe it’s on the roadmap (safe harbor!).
Hope you find this one useful! Catch you in the next one! ✌ And thank you for being an awesome reader! Subscribe to this blog for receiving all the latest updates straight to your inbox. 🙂

.png)




Comments