Available For Flow Screens
lightning:availableForFlowScreens
Enables a component to be used in flow screens.
For Use In
Lightning Experience
Add the lightning:availableForFlowScreens interface to a Lightning component to make it available for flow screens. This interface is supported only in Lightning runtime.
This example shows the markup required to add the lightning:availableForFlowScreens interface to a Lightning component.
After making the component available to flow screens, you can add a resource bundle to enable attributes that admins can edit in the Cloud Flow Designer. You can also replace the whole flow screen with your own component.
For more information, see the Lightning Aura Components Developer Guide.
Salesforce validates each flow screen when the user attempts to navigate to the next screen. If the flow screen is not valid, the user can’t progress. To validate the component with the flow screen, declare the validate attribute in the component. Set the validate attribute to a custom validation function that must return two parameters: isValid and errorMessage.
Here's example markup for a Lightning component with custom validation. The validate attribute is set by the component’s client-side controller later in this example.
Here's the corresponding client-side controller. When the component renders, the init handler sets the component's validate attribute to a function that validates the component. When the user navigates to the next flow screen, the function in the validate attribute is run.
- If the component is valid, the function returns the
isValidparameter as true and the user navigates to the next flow screen. - Otherwise, the function returns the
isValidparameter as false and a custom error message that displays under the Lightning component in the flow screen. The user can't navigate to the next screen until the function is successful.
