Logic Composer
Validation
Check one business rule and return Yes when the data is valid, for reuse in recipes, flows and other blocks.
A validation checks one rule. Its expression is Yes when the data is valid and No when it is not. Use a validation for a rule you want to reuse on its own, such as “a contact must be at least 18” or “the requested delivery date is after the order date”, and especially for rules that should stop a user from saving a row through a recipe.
When you have several related rules and want to know which of them failed, use a validation set instead.
Build a validation
Section titled “Build a validation”- Create a logic block and choose the Validation card. See Create a logic block.
- Add the inputs the rule needs on the Input tab, and any rows or queries on the Data tab.
- On the Validation tab, Write the rule: build a Yes/No Expression that is Yes when the data is valid.
- Give the block a name that reads as the message users should see if it fails (see below).
- Save, then select Run to test both a valid and an invalid case.
How it behaves
Section titled “How it behaves”- The block has a single Yes/No output named
result: Yes when the rule holds, No when it does not. - The block itself holds no error code or message. What the user sees depends on where the validation is used:
| Used in | When it fails |
|---|---|
| A recipe’s Validation stage | The create, update or delete is cancelled, and the block’s name is the message the user sees. |
| An expression (Run Logic Block) | You get result = No and decide what to do, for example in an If Condition. |
| A logic flow | The step that calls it returns result = No. Branch on it and use a Raise Error step to stop with your own code and message. See Error handling. |
- Watch empty values. An empty number counts as 0, and an empty Yes/No counts as No, so
Amount > 0is No whenAmountis empty. If “empty” should pass, say so:Or(Null(Amount), Amount > 0). See Empty values.
Examples
Section titled “Examples”Applicant age
Section titled “Applicant age”Inputs: BirthDate (Date and Time, Date Only)
Name: The contact must be at least 18 years old
Years(BirthDate, Now) ≥ 18Delivery date after order date
Section titled “Delivery date after order date”Inputs: OrderDate, RequestedDeliveryDate (Date and Time)
Name: The requested delivery date must be after the order date
And(Not Null(RequestedDeliveryDate), RequestedDeliveryDate > OrderDate)Within the customer’s credit limit
Section titled “Within the customer’s credit limit”Inputs: OrderId (Lookup to Order)
Data: the order, and its customer account with Credit Limit
Name: The order total exceeds the customer credit limit
Order.totalamount ≤ Customer.creditlimitUsed in a recipe’s Validation stage on Order Update, a sales rep who pushes an order over the limit cannot save it and sees the block’s name as the reason.