Insert excerpt | ||||||||
---|---|---|---|---|---|---|---|---|
|
Overview
Validation can be configured to check incoming data before completing an actionflow. This could be from simply checking if a field has been completed, to checking for duplicate records using a lookup to a
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|
Adding a validation phase
The simplest way to set up validation is to add a Validation phase at the start of the actionflow. This phase will do all the necessary checks and if these checks have passed before the next phase of the actionflow can be initiated using a
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|
The save button uses the following actionflow:
The edit form is wired into the actionflow and the
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|
The user decides that the name field must be supplied for every record and therefore adds a check to make sure this field is populated before saving. To do this:
- Add a phase before the current Processing Phase
- Name this Validation
- Click Connect to connect the form as an input into the actionflow.
- On the mappings popup, drag and drop the Name field to the interface to create a mapping
- Click Confirm Mappings
- Add a
node to the canvas by dragging and dropping from the toolbar.Insert excerpt _actionflow_calculate _actionflow_calculate nopanel true - Name this Validate Records
- Connect the interface connection point to Validate Records by dragging from the arrow to the node.
- On the mappings popup, drag and drop the Name field to the calculate to create a mapping.
- Click Confirm Mappings
- Click on Validate Records to open its editor. Add a calculate attribute:
Name: CheckName
Type: String
Order: 1
Expression:Code Block if(isNull(in.Name), do( error("Please provide a name."), stop("message") ), _NULL )
Note Using stop() will terminate the actionflow immediately at the node it is being used.
Using error() displays an error message to the user
- Add a
node to the canvas by hovering over the calculate node and selecting out as the output connection point.Insert excerpt _action_phase _action_phase nopanel true - Drop the line into empty space
- Select
Insert excerpt _action_phase _action_phase nopanel true - Select Processing Phase
The processing phase will only run if the actionflow is not terminated by the stop() function in the calculate node.
Validation involving lookups
To find out more about using validation to check for duplicates and to check a value against a list, see Using Lookups.