Build Invocable Actions That Work for Multiple Objects

After Spring 20, you can now create reusable Apex actions that use the generic sObject and List<sObject> data types. Build one action that works for multiple objects, rather than one for each individual object.

Developers can build a filter or sort action that works with any collection of records, from accounts and contacts to custom objects. Previously, developers couldn’t use polymorphic Apex structures in invocable actions because generic data types weren’t supported.

Create a custom action, or edit an existing one. Use the sObject or List<sObject> data type in invocable methods and attributes.

Previously, the example class would have been tied to the Account or Contact or myCustomObject__c object. But now developers create one action, and the Flow Builder admin chooses the object each time they use that action.

A new action screen with contact specified as the object for “recordsToCheck” input, and Account as the object for “recordsToReturn”.

Source

  • https://releasenotes.docs.salesforce.com/en-us/spring20/release-notes/rn_forcecom_flow_fbuilder_dynamic_types.htm?edition=&impact=

Leave a Comment