Validation in Flows – Overview
Validation refers to checking values before proceeding, to validate that the values meet the flow’s requirements. Validation logic is executed when a user runs a flow, but it can be created in a couple of different places.
Creating Validation in Flow Builder at ‘Design-Time’
Currently, validation support is uncomfortably inconsistent in Flow. The original set of components, such as the Checkbox component below, come with an elegant Validate Input section that allows for a formatted error message and the full use of formulas.
However, these standard components, which are also sometimes referred to as the ‘native’ components, were implemented in the early days of lightning in a somewhat proprietary manner. The Flow team is transitioning to use standard LWC screen components. However, Flow has not yet implemented the ‘Validate Input’ section shown above for standard LWC screen components, so when you add one, you won’t see any validation support, as shown in this Email component:
Then there are fields generated via Dynamic Forms for Flow, which is currently in Beta. These fields can be added by clicking on the Fields tab in Screen Builder and specifying the object you want via a record variable:
When you use fields directly on a Flow screen, you tap into traditional, classic field configuration. In this case, the standard field Validation Rules:
Developers can add validation logic to custom Flow screen components
Custom Components don’t automatically carry out validation but it’s easy for a developer to add code that will get called when the user attempts to close the components property editor.
The LWC logic is described here, and the older Aura approach can be found here.
On a related note, it’s possible to use a modal popup to implement more customized user experiences on a broader range of events.