- Code
Launch Flow and Get Return Values
// Create a map to store input parameters for the flow
Map<String, Object> params = new Map<String, Object>();
params.put('recordId', '001WU00000caG8VYAU');
// Initialize and start the flow
Flow.Interview.X22 flow = new Flow.Interview.X22(params);
flow.start();
// Get the return value from the flow and cast it to List<Contact>
List<Contact> returnValue = (List<Contact>) flow.getVariableValue('returnContact');
System.debug(returnValue);
- We can only use AutoLaunch flow here. We can’t use screen flow over here.