Skip to main content

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:

ComponentDescription
NameUnique identifier for the validation
DescriptionWhat the validation checks
InputsData to validate
OutputA single boolean (result: true = valid, false = invalid)
Validation ExpressionThe 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.

✓ValidateEmailValidation● AUTO
Email
Validation Expression
○Not empty
○Contains @
○Contains a domain
○Min 5 characters

Validation Expression​

The validation expression evaluates to true when the data is valid, false when invalid. Expressions use the Logic Fabric Expression Language - the same language used in Formulas.

Common Validation Patterns​

PatternDescriptionExample
Required FieldValue must be providedValue != null && Value != ""
Range CheckValue within boundsAmount >= MinAmount && Amount <= MaxAmount
Pattern MatchValue matches formatMATCHES(Email, emailPattern)
Date RangeDates in correct orderStartDate <= EndDate
Conditional RequirementRequired based on conditionIF(Status == "Approved", ApprovalDate != null, true)
Cross-Field ValidationFields must be consistentTotal == SUM(LineItems)
Expression Language Reference

For complete documentation of all functions and operators available in validation expressions, see the Logic Fabric 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 placed
  • RequestedDeliveryDate (DateTime): When customer wants delivery
  • TotalAmount (Money): Order total
  • CustomerCreditLimit (Money): Customer's credit limit
  • HasApprovedProducts (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 period
  • EndDate (DateTime): End of period
  • MaxDurationDays (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."