Adding Validation

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   View node. To see examples of validation which include lookups, also see Using Lookups.

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  Phase node. For example, a user has a list of objects and has created an edit form to add a new object.


The save button uses the following actionflow:

The edit form is wired into the actionflow and the  Save Records saves the fields on the form automatically.

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:

  1. Add a phase before the current Processing Phase
    1. Name this Validation
  2. Click Connect to connect the form as an input into the actionflow.
  3. On the mappings popup, drag and drop the Name field to the interface to create a mapping
    1. Click Confirm Mappings
  4. Add a  Calculate node to the canvas by dragging and dropping from the toolbar.
    1. Name this Validate Records
  5. Connect the interface connection point to Validate Records by dragging from the arrow to the node.
  6. On the mappings popup, drag and drop the Name field to the calculate to create a mapping.
    1. Click Confirm Mappings
  7. Click on Validate Records to open its editor. Add a calculate attribute:
    1. Name: CheckName
      Type: String
      Order: 1
      Expression:

      if(isNull(in.Name),
      	do(
      		error("Please provide a name."),
      		stop("message")
      	),
      	_NULL
      )
      		

      Using stop() will terminate the actionflow immediately at the node it is being used.

      Using error() displays an error message to the user

  8. Add a  Phase node to the canvas by hovering over the calculate node and selecting out as the output connection point.
    1. Drop the line into empty space
    2. Select  Phase 
    3. 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.