Conditions can be attached to a Business Rule (to determine whether an Action should fire) or to a Button (to determine whether the Button should be displayed). Conditions can significantly enrich the business logic and workflow of an app, as they ensure that events will only occur when appropriate.
For example, a Condition might be used to add a participant to a Phase only if a contract_amount Field is over $10,000. Or, a Condition might ensure that a Button is only visible when a transaction is in an appropriate Phase of its overall lifecycle.
In most cases, Conditions use Liquid to evaluate whether an expression is true or false. If the Condition evaluates to true, then the Condition is satisfied.
Here is a preview of what you will be building:
Before We Start ...
Let's Get Started!
In this tutorial, we’ll build a Condition that evaluates whether a contract_amount is over $10,000.
1. Browse to Conditions
Browse to an App’s Advanced Designer page. In the left-hand pane, select the Conditions node.
2. Add a New Condition
Select the Add button.
3. Configure the Condition
Provide this Condition with a Name; it can be helpful to use a very short description of what the Condition is evaluating for ease of reference later. In this tutorial, our Condition will check to see if the contract_amount for a transaction is over $10,000, so we’ll name our Condition contract_amount > 10,000.
Next, provide your Liquid expression in the Condition Field, as shown below:
New to Liquid? Check out our Crash Course on Liquid tutorial for an introduction.
Select OK to save the Condition.
4. Using Your Condition
Now that you’ve created your Condition, you’ll need to pair it with an Action in a Business Rule or Button to make use of it.
In the example below, we've attached both our Condition and an Add Participant (Add Jim as Financial Approver) action to a Transaction Initiated Business Rule. This Business Rule will only add a Financial Approver when the Condition evaluates to true (i.e., the contract_amount is over $10,000).
Need help configuring a Business Rule? Check out our Using a Business Rule to Trigger an Action tutorial.
Keep in mind that you can also use a Condition to determine whether or not a button should be displayed. You can check out our Creating a Button to Execute an Action tutorial to learn more.
Note that you can use the same Condition as many times as you like for different Business Rules or Buttons.
Test Out Your Condition
Congrats! You've just written your first Condition.
You can test it out by ensuring your Action only fires when your Condition's requirements are met.