Newer Version Available
lightning:flow
A lightning:flow component represents a flow interview in Lightning runtime.
Specify which flow to render with the name attribute. If it’s appropriate for your flow, initialize the flow’s input variables with the inputVariables attribute.
This example renders the Survey Customers flow (from the Create a Satisfaction Survey Trailhead project).
1<aura:component>
2 <aura:handler name="init" value="{!this}" action="{!c.init}"/>
3 <lightning:flow aura:id="flowData"/>
4</aura:component>In your client-side controller, identify which flow to start.
1({
2 init : function (cmp) {
3 var flow = cmp.find("flowData");
4 flow.startFlow("Survey_customers");
5 }
6})The referenced flow must be active.
Valid statuses for a flow interview are:
- STARTED: the interview successfully started.
- PAUSED: the interview was successfully paused.
- FINISHED: the interview for a flow with screens finished.
- FINISHED_SCREEN: the interview for a flow without screens finished, and the component displayed a default screen with this message: “Your flow finished”
- ERROR: something went wrong and the interview has failed.
Each flow component includes navigation buttons (Back, Next, Pause, and Finish), which navigate within the flow. By default, when the flow finishes, the component reloads the first screen for a new interview. To customize what happens when the flow finishes, add an event handler for the onstatuschange action when status contains FINISHED.
MethodsThis component supports the following methods.
- flowName (String): The unique name of the flow to render.
- inputVariables (Object[]): Sets initial values for the flow’s input variables.
- interviewId (String): ID of the interview to resume.
For more information, see Working with the Flow Lightning Component in the Lightning Components Developer Guide.
Attributes
| Attribute Name | Attribute Type | Description | Required? |
|---|---|---|---|
| body | Component[] | The body of the component. In markup, this is everything in the body of the tag. | |
| class | String | A CSS class for the outer element, in addition to the component's base classes. | |
| title | String | Displays tooltip text when the mouse moves over the element. | |
| onstatuschange | Action | The current status of the flow interview. |