Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Insert excerpt
_Banners
_Banners
nameactionflow
nopaneltrue

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
_action_view
_action_view
nopaneltrue
 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 an additional 'a Validation ' phase at the start of the actionflow. This phase will do all the necessary checks and if these checks have passed then before the next phase of the actionflow can be initiated using a 

Insert excerpt
_action_phase
_action_phase
nopaneltrue
 node. For example, a user has a list of objects and has created an edit form to add a new object.

Image Modified


The save button uses the following actionflow:

The edit form is wired into the actionflow and the 

Insert excerpt
_action_save
_action_save
nopaneltrue
 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 not null 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 
    Insert excerpt
    _actionflow_calculate
    _actionflow_calculate
    nopaneltrue
     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:

      Code Block
      if(isNull(in.Name),
      	do(
      		error("Please provide a name."),
      		stop()
      	),
      	_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


  8. Add a 
    Insert excerpt
    _action_phase
    _action_phase
    nopaneltrue
     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 
      Insert excerpt
      _action_phase
      _action_phase
      nopaneltrue
       
    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.