Decisions are a critical Service Block type - as they allow workflows to take diverging paths depending on data gathered by Dodgeball.
They are available under the Actions/Logic section of the Step Palette
Defining Paths
The first thing to set up for a decision is which paths are available for the workflow to take. It helps to name these in a way that is easily intuitive and flexible.
These paths will process from 1 - N until they find one that passes all tests, then they will proceed down that path. For this reason, the path order is important.
Let’s set up a checkpoint with four paths
These paths are stable and can have the logic changed over time without impacting the structure of the workflow.
Conditions Overview
Each path can have an arbitrary number of conditions, which must be met before it can be taken.
You can get to the condition overview by clicking the pencil icon next to a path, or immediately start adding a condition by clicking “+ add.”
Conditions start in a single “box” - where all conditions must be true to succeed. This is called “AND” logic
You can also define a new “box” of conditions by clicking “+ OR Condition” - if any box of conditions is true, the path will be taken.
In the example below, we have two “boxes” of conditions - either the customer must have the VIP label OR the customer must have the AlwaysTrust label.
Condition Editor
If you click on an individual condition or add a new one, you will be brought to the Condition Editor, which looks like this
Key elements of the Condition Editor include:
- Search Data Elements
- Use this field to search available fields for something you want to decision off, or to add a new field, which will be expected via event data, or historical context
- Logic / Comparator
- Depending on the type of data element you select, you will have different “Logic” options
- Strings can do various text search operations
- Numbers can do mathematical comparisons
- Booleans can do true/false comparisons
- Dates can do date comparisons, including comparisons relative to the current date
- Depending on the type of data element you select, you will have different “Logic” options
- Value
- What reference value are you comparing against?
- If your logic is “Contains” your value could be @gmail.com and you could search for it in the data element customer.primaryEmail
- What reference value are you comparing against?
Advanced Condition Editor (Free Form)
The free form editor gives you a way to look into historical data from Dodgeball, not limited to the current checkpoint.
Free form functions can be quite complex, and you may need the help of a Dodgeball Engineer to write them. There are limitations to free form functions as well, so it is important to make sure clients know that we can access historical data, but each use case may take some consultative motion to get it right for their context.
That being said, some common use cases and examples for Free form functions are below:
- Count events by name for the lifetime of the customer CUSTOMER.events("SOME_SERVER_EVENT").count.isEqualTo(0)
- Count events by name for some window of time relative to today for the customer CUSTOMER.events("SOME_SERVER_EVENT").window("P1M").count.isEqualTo(0)
- Count checkpoints by name for the lifetime of the customer CUSTOMER.checkpoints("SOME_CHECKPOINT").count.isEqualTo(0)
- Count checkpoints by name for some window of time relative to today for the customer CUSTOMER.checkpoints("SOME_CHECKPOINT").window("P1M").count.isEqualTo(0)
To use a free form condition, click the “Free Form” tab from the Condition Editor.
As you type, the tooltip on the left will adjust to help guide you through the available functions.
I’ve shown a series of steps below that show how this guidance works
Understanding Decisions
Now that we are done defining the decision, we can see in our overview that we have four paths (including the catchall default path) - We should be able to summarize the decision just by looking at this view.
- Check if the customer is labeled as “VIP”or “AlwaysTrust” - if so, go down “AutoAllow”
- Check if the customer or device is labeled as “KnownBad” - if so, down the “AutoReject” Path
- Check if we sent event data called “extraScrutinyRequired” and the values is true - if so, go down the “ExtraScrutiny” path.
- Otherwise, go down the default path