Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
Configure the Client-Side Controller for a Flow Local Action
Asynchronous Code
When a Promise is resolved, the next element in the flow is executed. When a Promise is rejected or hits the timeout, the flow takes the local action's fault connector and sets $Flow.FaultMessage to the error message.
By default, the error message is “An error occurred when the elementName element tried to execute the c:myComponent component.” To customize the error message in $Flow.FaultMessage, return it as a new Error object in the reject() call.
1({
2 invoke : function(component, event, helper) {
3 return new Promise(function(resolve, reject) {
4 // Do something asynchronously, like get data from
5 // an on-premise database
6
7 // Complete the call and return to the flow
8 if (/* request was successful */) {
9 // Set output values for the appropriate attributes
10 resolve();
11 } else {
12 reject(new Error("My error message")); }
13 });
14 }
15})Synchronous Code
When the method finishes, the next element in the flow is executed.
1({
2 invoke : function(component, event, helper) {
3 // Do something synchronously, like open another browser tab
4 // with a specified URL
5
6 // Set output values for the appropriate attributes
7 }
8 })