Set Flow Input Variable Values from a Wrapper Aura Component
When you embed a flow in a custom Aura component, give the flow more context by initializing its variables. In the component’s controller, create a list of maps, then pass that list to the startFlow method.
We recommend using Lightning web components because they perform better and provide the latest functionality. See Embed a Flow in a Custom Lightning Web Component.
You can set variables only at the beginning of an interview, and the variables you set must allow input access. If you reference a variable that doesn’t allow input access, attempts to set the variable are ignored.
For each variable you set, provide the variable’s name, type, and value. For type, use the API name for the flow data type. For example, for a record variable use SObject, and for a text variable use String.
In this example, this JavaScript controller sets values for a number variable, a date collection variable, and a couple of record variables. The Record data type in Flow Builder corresponds to SObject here.
In this example, the Apex controller passes the data to the flow’s record variable through the JavaScript controller.
See Also