Using Validation Engine for Entities

Last Updated: 08/12/2016 Introduced in Verision: 2.0

A folder entity can have validation applied, set up in the form of rules or a flow created by the entity’s action folder. Setting up validation rules is particularly useful if the Action menu is to be used to manually add an entity rather than creating the entity by executing a flow. You can emulate the rules set up in a flow that creates the same entity, for example, using the Advance Rule, Create Validation Flow, and Simple Rule validation options.

 
 firstScreen
 
 
  • Simple Rule – By default set to a logical rule, this rule enforces a true/false evaluation when creating an entity. 
  • Advanced Rule – By default set to data return rule, returning data of type ValidationIssue. You can get more sophisticated in your validation using this type; for example, using either Warn or Fatal error level and providing a custom error message.
  • Create Validation Flow – A flow is used to enforce validation. For example, a database lookup to see if the vendor exists in the corporate “vendors” database before submitting a bid for a project.  

Simple Rule Example

This example will create a simple rule to validate that a “Quote Amount” field is greater than $1,000. This example assumes a folder entity called “CapEx Quote” already exists, which is used to submit a quote for a project. Its properties are:
 addCapex
 
 
The Add Cap Ex Quote screen above is what appears when the Add > CapExQuote option is selected:
 
 addCapExQuote
 
 
The only existing validation on the Add Cap Ex Quote screen is for requiring EntityName. A simple rule will be added to enforce a minimum quote amount of $1,000. Browse to the actions folder for the entity, which in this example, is under System > Common Data Elements > Actions > Entity Actions.
 
Click on Validation Rule > Simple Rule.
 createSimpleRule
 

 
 
Name the rule and click OK.
 nameRuleQuoteAmount
 
 
By default, the rule input data is set to the entity, therefore it is not necessary to specify input data for the rule to evaluate in this example. (However you should want to evaluate additional data and factor that into the decision-making.) In the Start Rule window, click  Add New Rule Step.
 addNewRuleStepFirst
 
 
Expand Entity [CapExQuote] and select QuoteAmount. Click Next.
 
 selectQuoteAmt
 
Expand Number Rules and select Greater Than Or Equal To, and click Next.
 
 greaterThanOrEqualTo
 
 
Lastly, type 1000 in the Value field and click Done.
 
 constantThousand
 
Save and close the rule.
 
Back in the portal, navigate to a folder that has the entity action for adding the entity for which the rule was established. Click the Add option for the entity.
 
addCapExQuote 
 
 
 
Notice at the bottom the new validation for Quote Amount. The entity cannot be added until the rule evaluates true, therefore enforcing the minimum dollar amount.
 ResultSimpleExample
 
 

Advanced Rule Example

This example will create an advanced rule to validate that a “Quote Amount” field is greater than $1,000. The difference between the advanced rule and the simple rule in the first example is that the advanced rule produces a custom error message. (NOTE: If you created the first rule, delete that rule prior to building this one since they both evaluate the same field.)
 
This example assumes a folder entity called “CapEx Quote” already exists, which is used to submit a quote for a project. Its properties are:
 addCapex
 
 
The Add Cap Ex Quote screen above is what appears when the Add > CapExQuote option is selected:
 addCapExQuote
 
 
 
The only existing validation on the Add Cap Ex Quote screen is for requiring EntityName. A simple rule will be added to enforce a minimum quote amount of $1,000. Browse to the actions folder for the entity, which in this example, is under System > Common Data Elements > Actions > Entity Actions.
 
Click on Validation Rule > Advanced Rule.
createAdvanceRule
 
 
Name the rule and click OK.
nameAdvancedRule
 
 
Notice the difference in the properties, compared to the simple type of rule:
 
 advancedRuleFirstLook
 
The Rule Type is set to Data Return Rule, and there are options for output data for both the false and true evaluations of the rule. The output data type is ValidationIssue, which includes the following properties:
 valuesProperties
 
 
In the Start Rule window, select Add New Rule Step.
 
Expand Entity [CapExQuote] and select QuoteAmount. Click Next.
 secondQuoteAmt
 
 
Expand Number Rules and select Greater Than Or Equal To, and click Next.
 
 greaterThanOrEqualSecond
 
 
Lastly, type 1000 in the Value field and click Done.
 
 constantThousandSecond
 
Next, set the true and false data to return. In this example, we’ll simply use constant data. Under Then section Else Return, select the mapping type Constant. Click the Add New button, and enter the following:
 falseOutcome
 
 
  • Details – Can be left blank, and is simply a description field for the rule entity.
  • Level – Either Warn or Fatal, Warn would alert the user but allow the action on the entity to proceed. Fatal does not let the action proceed until the rule evaluates true.
  • Reason – This is the message that appears to the user after the rule is evaluated.
  • Reference Property – This is the name of the Entity.[property] being evaluated.
  • Source – Can be left blank; by default, this is a System.Object. This field is relevant if there were editable properties of the object.
Leave Then > Return mapping value Null, since we do not need to take action for when the rule evaluates true.
 
 resultSecondAdvancedRule
 
Save and close the rule.
 
Back in the portal, navigate to a folder that has the entity action for adding the entity for which the rule was established. Click the Add option for the entity.
 addCapExQuote
 
 
 
 
Notice the new validation for Quote Amount. The entity cannot be added until the rule evaluates true, therefore enforcing the minimum dollar amount.
 advancedRuleDesign
 

Custom Validation Flow Example

In this example, a validation flow is used to see if the vendor exists in the company database. If not, the vendor is not permitted to provide a quote. Placeholder components are used in the flow to simulate the database lookup.
This example assumes a folder entity called “CapEx Quote” already exists, which is used to submit a quote for a project. Its properties are:
 addCapex
 
 
Browse to the actions folder for the entity, which in this example, is under System > Common Data Elements > Actions > Entity Actions.

 
Click on Validation Rule > Create Validation Flow.
 
Name the rule and click OK.
 nameValidationRule
 
 
The flow is automatically configured with the entity input data. Conceptually, the database lookup would resemble:
 flowConnected
 
 
The Done path represents the existence of the vendor, and is therefore connected to the Valid path. The validation on the entity will pass when this path it taken. The Failed path represents the vendor not existing in the corporate database, therefore it is connected to the Invalid end step. Click on the Invalid step. Notice the Output data by default is ValidationIssues.
 
Under Inputs > ValidationIssues, change the mapping type to Constant. Click on Add and configure the following:
 setUpValidationIssues
 
 
This completes the validation flow. When the entity is added or edited, the validation flow will execute and perform a lookup for the vendor and produce a fatal warning if the vendor is not found.
 
 

Additional Resources