SOQL and DML limits apply during flow execution. See Per-Transaction Flow Limits in the Salesforce Help.
{ Map<String, Object> inputs = new Map<String, Object>(); inputs.put('AccountID', myAccount); inputs.put('OpportunityID', myOppty); Flow.Interview.myNamespace.Calculate_discounts myFlow = new Flow.Interview.myNamespace.Calculate_discounts(inputs); myFlow.start(); }
public void callFlow(String namespace, String flowName, Map <String, Object> inputs) { Flow.Interview myFlow = Flow.Interview.createInterview(namespace, flowName, inputs); myFlow.start(); }
public class SampleController { //Instance of the flow public Flow.Interview.Flow_Template_Gallery myFlow {get; set;} public String getBreadCrumb() { String aBreadCrumb; if (myFlow==null) { return 'Home';} else aBreadCrumb = (String) myFlow.getVariableValue('vaBreadCrumb'); return(aBreadCrumb==null ? 'Home': aBreadCrumb); } }
The following are instance methods for Interview.
public static Flow.Interview createInterview(String namespace, String flowName, Map<String,ANY> inputVariables)
Type: Flow.Interview
Use this method to dynamically create a Flow.Interview object for the start() method.
system.debug('My Output Variable: ' + myFlow.varName);
system.debug('My Output Variable: ' + myFlow.getVariableValue('varName'));
If the flow doesn't exist in the current org, a TypeException is thrown.
public static Flow.Interview createInterview(String flowName, Map<String,Object> inputVariables)
Type: Flow.Interview
Use this method to dynamically create a Flow.Interview object for the start() method.
system.debug('My Output Variable: ' + myFlow.varName);
system.debug('My Output Variable: ' + myFlow.getVariableValue('varName'));
If the flow doesn't exist in the current org, a TypeException is thrown.
public Object getVariableValue(String variableName)
Type: Object
The returned variable value comes from whichever flow the interview is running. If the specified variable can’t be found in that flow, the method returns null.
This method checks for the existence of the variable at run time only, not at compile time.
public Void start()
Type: Void
When a flow user invokes an autolaunched flow, the active flow version runs. If there’s no active version, the latest version runs. When a flow admin invokes a flow, the latest version always runs.