Versions Compared

Key

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

Insert excerpt
_Banners
_Banners
nameactionflow
nopaneltrue

Overview

Coming SoonValidation can be configured to check data as it is being entered and 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.

Table of Content

Table of Contents
maxLevel2
minLevel2
indent5px


Validation Details - _field.errors

Validation is checked On Blur, which means once the user leaves the field the validation is run. It is also checked when an existing record is loaded.

Where validation fails an error will be displayed by default when a user places their mouse over an invalid field explaining what this issue is. Conditional formatting can be used to highlight the field and display the error message. The error details are accessed using the internal variable _field.errors.


Prevent Saving of Invalid Fields

Coming soon.


Adding a Confirmation Message

See Configure a Confirmation


Form Field Validation - Mandatory Field

Setting a form field as mandatory

  1. On the form field you would like to set as mandatory select its inner input field.
  2. In the properties that open n the right, scroll down to the Validation section.
  3. Click on the tick box next to mandatory.
    1. It is also possible to enter an error message that will be used by the mouseover and accessible using _field.errors
  4. These settings are illustrated below:
    1. Image Added
  5. Insert excerpt
    _save
    _save
    nopaneltrue
     your changes.
  6. If using a Serene Grey Template, the fields failing validation will appear with a red under. 


Form Field Validation - Minimum Length

  1. On the form field you would like to set a minimum or maximum length for, select its inner input field.
  2. In the properties, scroll down to the Validation section.
  3. Next to Validation Type click 
    Insert excerpt
    _addIcon
    _addIcon
    nopaneltrue
    .
    1. A validation type can also be selected from the drop-down if the desired validation exists or edited by clicking the Validation Type hyperlink.
  4. The Validation Type properties open, see Validation Type.
  5. Enter:
    1. Name, this should be indicative of its purpose. For example, minimum name length.
    2. Base Type, select the type of data. Different data types have different parameters such as numbers specifying the maximum value. For example, String.
    3. Minimum Length, sets the minimum number of characters. For example, 2.
    4. Maximum Length, sets the maximum of characters. If left blank there is no maximum. For example, 150.
  6. Insert excerpt
    _save
    _save
    nopaneltrue
     your changes.
    1. These options are illustrated below: 
    2. Image Added
  7. If using a Serene Grey Template, the fields failing validation will appear with a red under. 


Form Field Validation - Matching a Given Pattern

  1. On the form field you would like to set a pattern match for, select its inner input field.
  2. In the properties, scroll down to the Validation section.
  3. Next to Validation Type click 
    Insert excerpt
    _addIcon
    _addIcon
    nopaneltrue
    .
    1. A validation type can also be selected from the drop-down if the desired validation exists or edited by clicking the Validation Type hyperlink.
  4. The Validation Type properties open, see Validation Type.
  5. Enter:
    1. Name, this should be indicative of its purpose. For example, minimum name length.
    2. Base Type, select the type of data. Different data types have different parameters such as numbers specifying the maximum value. For example, String.
    3. Pattern, define a pattern the input must adhere to in the form of a regular expression. Pattern example provided at the end of this section.
  6. Insert excerpt
    _save
    _save
    nopaneltrue
     your changes.
    1. These options are illustrated below: 
      1. Image Added
  7. If using a Serene Grey Template, the fields failing validation will appear with a red under. 

Example Patters

See Regular Expressions for details on how to create a pattern.

DescriptionPattern
Alpha Only[A-Za-z]
Alpha Numeric including, hyphens, underscores, spaces, ampersands and full stops

[A-Za-z0-9\s\-_.)(\/\-\&]

Numeric Only[0-9]
Email

^[a-zA-Z0-9!#$%&'*+/=?^_‘{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_‘{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$

Specific words e.g. hello or world\b(hello|world)\b


Verify a Record is Selected

This is achieved by performing a lookup on the data that is driving the actionflow. The setup is as follows:

  1. Open the actionflow that will check a record is selected.
  2. Above the actionflow canvas are the phases. On the Processing Phase click
    Insert excerpt
    _add
    _add
    nopaneltrue
    .
  3. Select Add Phase Before and set the Name to Record Counter.
  4. Click Connect on the connections pane and select the Event input.

  5. Click 

    Insert excerpt
    _add
    _add
    nopaneltrue
     in the Connections pane:

    1. Name, the connection CountRecords

    2. Select Lookup

    3. Click Create Connection Point

    4. Select theView Component, which contains the grid we are checking has a selected record.

    5. Click Connect Input
  6. On the mappings screen that appears drag the UID, or other primary key, across to create a mapping.
    1. Make sure the data being used is set to Selected Records.
    2. Click Save
  7. Create a 
    Insert excerpt
    _action_calculate
    _action_calculate
    nopaneltrue
     Node by dragging and dropping from the toolbar
    1. Name the node Count Records
  8. Connect the Event Input Connection to the calculate. This is what causes the actionflow to run.
  9. Connect the Lookup Input Connection, Count Records, to the calculate.
    1. Select Add Lookup
    2. Name the connection lu
    3. Drag and drop the UID field to create a mapping to the Calculate node.
    4. Click Confirm Mappings
  10. Click on the Calculate node to open its editor.
    1. In the Calculate Attributes section, click

      Insert excerpt
      _addIcon
      _addIcon
      nopaneltrue
      .

    2. Use the following settings:

      1. Name: Count

      2. Type: integer

      3. Expression, countElements(lu.UID).

        1. This counts the number of selected records on the grid we are looking up.

      4. Save the attribute
    3. We will now create a second attribute that will hold the message for the user.
    4. In the Calculate Attributes section, click

      Insert excerpt
      _addIcon
      _addIcon
      nopaneltrue
      .

    5. Use the following settings:

      1. Name: Message

      2. Type: string

      3. Expression, "Please select 1 record from the grid."

      4. Save the attribute

  11. We now have a count of the number of selected records.
  12. Checkpoint
    1. Image Added
  13. We can now use a gateway action to allow the actionflow to continue if we have 1 record or pass a message back to the user to inform them of what to do.
  14. Drag a 
    Insert excerpt
    _action_gateway
    _action_gateway
    nopaneltrue
     action from the toolbar onto the canvas.
    1. Name, Decision
    2. Click Create Action
  15. Connect the Calculate Action to the Gateway Action.
    1. In the mapping window that opens drag the Count and Message attributes to the right to create gateway input attributes.
      1. To change these mappings in the future click on the connecting line.
    2. Click Save
  16.  Click on the Gateway Action to open its properties.
    1. In the Rules section double-click the existing rule.
      1.  Set Expression to, in.Count == 1
        1. Note these expressions must equate to true or false, therefore there is n need to provide an if statement as it is implied.
      2. Insert excerpt
        _finish
        _finish
        nopaneltrue
         your changes.
    2. In the Rules section click 
      Insert excerpt
      _addIcon
      _addIcon
      nopaneltrue
      , and set the following:
      1. Name, Message.
      2. Expression, in.Count != 1
      3. Insert excerpt
        _finish
        _finish
        nopaneltrue
         your changes.
  17. The Gateway Action now has two outputs available, out and Message.
    1. Out,
      1. Drag a Start Phase action onto the canvas.
      2. Select Processing Phase, or whichever phase you require.
      3. Place your mouse over the Gateway, click on out and drag it to connect to the Start Phase action. Out runs when the user has selected 1 record so we want to continue with our actionflow.
    2. Message,
      1. Create an output connection

      2. Click 

        Insert excerpt
        _add
        _add
        nopaneltrue
         in the Connections pane:

      3. Name, the connection screen

      4. Select Output

      5. Click Create Connection Point

      6. Select theForm Component, this will require a dynamic text to write to. If you do not have a dynamic text on your screen create one before continuing.

      7. Click Connect Output.
      8. Drag the Count and Message attributes to the right to create outputs.
      9. Right-click on the line connecting the output connection back to your screen's form and select Configure Mappings.
      10. Map your Message attribute onto the dynamic text area on your screen. This will display the message where a user has not selected a single record.
  18. Checkpoint
    1. The final configuration will look like this

    2. Image Added

    3. In this example setup, if a user tries to click edit on the screen without having first selected a record, a message will appear on the screen informing them to select a record. 


Duplicate Entry Check

The following example will check for a duplicate company name match when trying to save a new company record.

  1. Open the actionflow that will check a record is selected.
    1. Above the actionflow canvas are the phases. On the Processing Phase click
      Insert excerpt
      _add
      _add
      nopaneltrue
      .
    2. Select Add Phase Before and set the Name to Duplicate Check.
  2. Click on Click to Connect on the Connections pane.

  3. Connect the Form as an input into the actionflow and click Connect Input.
  4. The Mappings Screen opens, map in the Name attribute you wish to check for duplicates.
  5. Create a Image Added Calculate node by dragging and dropping from the toolbar.
  6. Connect the Input Connection Point to the Calculate Action and map in the Name attribute.
  7. Hover over the Calculate Action and select Add Lookup.
  8. Name it dup.
  9. Drop the arrow into space on the canvas to create the 
    Insert excerpt
    _action_view
    _action_view
    nopaneltrue
     
    node.
    1.  Name the View Companies, or something appropriate for your use case.
    2. Select the table where you are checking for duplicates, this will be the primary table.
    3. An output attribute selection popup will appear. Add attributes to the view node by selecting all the attributes and dragging and dropping them onto the Output Attributes section on the View property editor.
    4. Click Next
  10. Select the dashed line connecting the Calculate to the View to open the Mappings:
    1. Incoming Mappings, are used to filter the records in the view. These can be thought of as the request details. Drag and drop the Name attribute to the View node section to create a mapping. This will be used to configure the filter later.
    2. Click Next
    3. Outgoing Mappings are the attributes returned from a lookup. Drag and drop UID, or the primary key for your table, from the View to the Calculate Action. This will be used in the calculate attribute expression later.
  11. Creating a filter. Click on the  
    Insert excerpt
    _action_view
    _action_view
    nopaneltrue
     
    node to open its editor. Under Data Retrieval Options click 
    Insert excerpt
    _addIcon
    _addIcon
    nopaneltrue
    next to the Default Filter to add a filter. Provide the following information:
    1. Name: Filter by Name
    2. Private: false
    3. Select the options:

      1. Name

      2. equals

      3. in.Name. Make sure to click the 'abc' button to convert it to an expression.

    4. Case Sensitive, turn this off if you want to remove

      Insert excerpt
      _finish
      _finish
      nopaneltrue
       your changes.

  12. Click on the Image Added Calculate node to open its editor and add a Calculate Attribute with the following settings
    1. Name, DuplicateCheck

    2. Type, Integer

    3. Order, 1

    4. Expression,


      Code Block
      // This will display a user error and stop the actionflow immediately if // any duplicates are found.
      
      do(
          $count = countElements( dup.UID ),
          if($count > 0,
              do(
                  error("There is already a Company with the name: "+in.Name),
                  stop()
      		)
          ),
          $count
      )


    5. It is possible to remove the stop() from the expression and instead, use a Gateway Action to decide if to continue to the next phase (see next step) or write a message back to the screen for the user to see.
  13. Insert excerpt
    _save
    _save
    nopaneltrue
     all your changes.
  14. Hover over the Image Added Calculate and click Out.

    1. Drag the arrow into space on the canvas and click where the new node should appear.
    2. Select 
      Insert excerpt
      _action_phase
      _action_phase
      nopaneltrue
      and select Processing Phase. This will then run the processing phase if the actionflow hasn't been stopped by the DuplicateCheck attribute.


Validation Involving Lookups

To find out more about using validation to check for duplicates or to check a value against existing data, see Using Lookups.


Validation Phase Example

Setting up a Validation Phase at the start of an actionflow. This phase will do all the necessary checks and if these checks have passed 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 and wants to verify some information about the entry.

Image Added


The save button in this example by default 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.

Image Added


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 
    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 section to create a mapping.
  7. Click Confirm Mappings
  8. Click on Validate Records to open its editor. Add a calculate attribute:
    1. NameCheckName

    2. TypeString

    3. Order, 1

    4. Expression,

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


      Note

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

      error() displays an error message to the user.


  9. Add a 
    Insert excerpt
    _action_phase
    _action_phase
    nopaneltrue
     node to the canvas by hovering over the Calculate Action 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.
  10. The processing phase will only run if the actionflow is not terminated by the stop() function in the Calculate Action.