Validation
Overview
A Validation Logic Block is a business rule that yields a boolean output - either true (valid) or false (invalid). Validations are used extensively to verify input values, check preconditions, and ensure post-conditions are met.
Validations are essential for:
- Input Validation: Ensuring data entered by users meets requirements
- Preconditions: Verifying conditions are met before an action proceeds
- Post-conditions: Confirming expected state after an action completes
- Business Rule Enforcement: Ensuring data complies with business policies
Structure
A Validation consists of:
| Component | Description |
|---|---|
| Name | Unique identifier for the validation |
| Description | What the validation checks |
| Inputs | Data to validate |
| Output | A single boolean (result: true = valid, false = invalid) |
| Validation Expression | The boolean rule to evaluate |
The Validation block itself produces only the boolean result. The failure error message is supplied where the validation is consumed - within a Validation Set, a Logic Recipe, or a Logic Flow - rather than being stored on the block. The examples below show the intended message alongside each rule for clarity.
Live Demo
Type an email address and watch each rule in the validation expression evaluate in real time.
Validation Expression
The validation expression evaluates to true when the data is valid, false when invalid. Expressions use the Flowon Expression Language - the same language used in Formulas.
Common Validation Patterns
| Pattern | Description | Example |
|---|---|---|
| Required Field | Value must be provided | Value != null && Value != "" |
| Range Check | Value within bounds | Amount >= MinAmount && Amount <= MaxAmount |
| Pattern Match | Value matches format | MATCHES(Email, emailPattern) |
| Date Range | Dates in correct order | StartDate <= EndDate |
| Conditional Requirement | Required based on condition | IF(Status == "Approved", ApprovalDate != null, true) |
| Cross-Field Validation | Fields must be consistent | Total == SUM(LineItems) |
For complete documentation of all functions and operators available in validation expressions, see the Flowon Expression Language Reference.
Example: Email Validation
Name: ValidateEmail
Inputs:
Email(String): Email address to validate
Output:
IsValid(Boolean)
Validation Expression:
Email != null
&& Email != ""
&& CONTAINS(Email, "@")
&& CONTAINS(Email, ".")
&& LEN(Email) >= 5
Error Message: "Please enter a valid email address"
Example: Order Validation
Name: ValidateOrderForSubmission
Inputs:
OrderDate(DateTime): When order was placedRequestedDeliveryDate(DateTime): When customer wants deliveryTotalAmount(Money): Order totalCustomerCreditLimit(Money): Customer's credit limitHasApprovedProducts(Boolean): Whether all products are approved for sale
Output:
IsValid(Boolean)
Validation Expression:
OrderDate != null
&& RequestedDeliveryDate > OrderDate
&& ADDDAYS(OrderDate, 3) <= RequestedDeliveryDate
&& TotalAmount > 0
&& TotalAmount <= CustomerCreditLimit
&& HasApprovedProducts == true
Error Message: "Order cannot be submitted. Check delivery date (min 3 days), credit limit, and product availability."
Example: Date Range Validation
Name: ValidateDateRange
Inputs:
StartDate(DateTime): Beginning of periodEndDate(DateTime): End of periodMaxDurationDays(Integer): Maximum allowed duration
Output:
IsValid(Boolean)
Validation Expression:
StartDate != null
&& EndDate != null
&& StartDate <= EndDate
&& DATEDIFF(StartDate, EndDate) <= MaxDurationDays
Error Message: "Invalid date range. End date must be after start date and within the maximum duration."