In this article, we'll explore how to effectively pass multiple parameters from a flow to an Apex class in Salesforce Lightning.
If you attempt to create an invocable method that accepts multiple input parameters, you may encounter the error Only one parameter is supported on methods with @Invocable annotation.
To resolve this, you can define an inner class with multiple variables, each annotated with @InvocableVariable. Here are the steps to follow for this approach.
Step 1: Create an apex class (Name: OpportunityHandler)
Step 2: Create a flow and invoke
the newly created apex class
The complete flow looks as below (Record-Triggered Flow on opportunity object)
In the apex action, we pass three variables to the Apex class: the Opportunities list, the Account list, and the Account name
Newly created record-triggered flow executes on an update of any Opportunity record.
If you have any questions or comments, please leave them in the comments section below.
Until then…
0 Comments