Apex Aide apexaide

How to Use an Apex-Defined Object with the Datatable Flow Component

By Eric Smith· ericsplayground.wordpress.com· ·Intermediate ·Developer ·6 min read
Summary

This content explains how to leverage Apex-Defined objects within Salesforce Flows using a custom Datatable Lightning Web Component. It demonstrates creating an Apex descriptor class to define the object structure and shows how to serialize and deserialize records to interface with the Datatable component. With this approach, Salesforce teams can create more flexible Flow screens that handle user-defined data types, enable editing, selection, and batch operations in Flows. The post also includes sample Apex code and configuration tips for building such solutions, enabling developers to integrate custom objects and complex data handling directly into declarative automation.

Takeaways
  • Create an Apex Descriptor class to define Apex-Defined objects for Flow use.
  • Serialize Apex-Defined record collections to JSON strings for Datatable input.
  • Use an Apex Flow Action to convert between record collections and serialized strings.
  • Manually configure Datatable columns when using User Defined objects.
  • Ensure unique Key Field values in Datatable for correct functionality.

How to Use an Apex-Defined Object with the Datatable Flow Component Updated 1/23/21 to reference the v3 version of the Datatable that utilizes a Custom Property Editor. I’ve updated my Datatable Lightning Web Component for Flow Screens to support a User Defined (also know as an Apex-Defined) object. See my Flow and Process Builder List View with Batch Delete App for an example. To work with an Apex-Defined object in your Flow, you need to create an Apex Descriptor Class for the object. SampleClassDescriptor.cls // Apex-Defined Variable Sample Descriptor Class public with sharing class SampleClassDescriptor { // @AuraEnabled annotation exposes the methods to Lightning Components and Flows @AuraEnabled public String field1; @AuraEnabled public String field2; @AuraEnabled public Boolean field3; @AuraEnabled public Integer field4; // Define the structure of the Apex-Defined Variable public SampleClassDescriptor( String field1, String field2, Boolean field3, Integer field4 ) { this.

Flow BuilderUncategorized