Validation rules are used to determine videos that you do not want created. If a video should not be created because a vital piece of information is missing or inaccurate, you should create a validation rule for it.
For example, if you want to include a customer’s first name on screen in your video and a default such as “Hello There” is not acceptable, we can create a validation rule so a video missing that piece of information will not be rendered.
Although we always encourage setting a default fallback for any dynamic element, validation rules help you plan for outliers and worst case scenarios should there be an issue with your data.
Validation rules are particularly helpful for outliers, i.e., those instances that seem highly unlikely to occur in your data, but somehow do. Here are two examples:
Example 1 - If you know a field should be between “1” and “10” but the data comes back “11”, you may want to create a validation rule to not render that video.
Example 2 - If a field should have 3 possibilities, “A” “B” or “C”, but the data comes back “7”, you may want to create a validation rule to not render that video.
Validation types include whether or not the data point:
- Exists
- Is something specified
- Is Not something specified
- Starts with a given letter
- Ends with a given letter
- Contains
- Less Than or More Than a specified number
- Shorter Than or Longer Than a specified number of characters
- Exists (or does Not Exist) in a provided property file
- Comes Before or After a specified date
- Or any combination of the above
Follow the below steps to create a validation rule for your storyboard:
- From the Storyboard, click on the three dot menu in the top right corner then click Set Validation Rules.
- Click on the + icon.
- Next, select the Parameter from the first drop down menu.
- Enter the appropriate Operation to complete the logic rule, for example:
- Once done, click Ok to save your validation rule.
- With the panel closed, use the Preview button to test your validation rule and make sure it’s working as expected.
For this example, we should find that if the Account Status value is ‘Blocked’ the Preview fails with the following message:
Error in API: Parameter ‘Account Status’ with value ‘blocked’ raises the error: ‘is ‘Blocked’.
A few things to note:
- Multiple validation rules can be set up using a Validation Group with And/Or logic. In the below example, a video will not be created if the First Name parameter is Empty OR if the Account Status is Blocked.
- And/Or logic cannot be combined within one Validation Group.
- Whenever possible, it is important to add a default value for all dynamic placeholders. Learn more about setting a default here.