Feature Sub Rules and Branches
Global Feature Sub Rules are Sub Rules that can be used within any Feature Rule you create.
They are managed within the Rules tab of your Zephr Admin Console and can be found by navigating to Rules > Feature Sub Rules.
Within this section, you will see two lists. The first, Sub Rules, provides a list of Sub Rules that have been created. The second, Sub Branches, shows a list of Sub Branches that have been created. Sub Rules are used in the middle of a Rule and cannot be used to finish a rule, whilst Sub Branches sit at the end of a Rule and results in transformations of your Feature.
Creating a Feature Sub Rule
From within the Feature Sub Rules screen, click Add Sub Rule and you’ll navigate to the Rule Builder.
For Sub Rules, the rule builder is almost identical to a regular Feature Rule, except for one key difference. Sub Rules have a blue node for Start Sub Rule, and an additional blue node for Finish Sub Rule. This is because Sub Rules allow you to condense more complex logic into the middle of a Feature Rule within a single node, so you don’t have a clutter canvas when making complex decisions. Every thing you put within this Sub Rule will be viewed as a single node when added to a Feature Rule.
In the example below, you’ll see a Sub Rule that looks to see if a user has a single meter remaining. If they do, it triggers a Special Offer webhook. If they do not, it continues the rule.
Note that triggering the webhook is not the end of the feature rule, and both options from the meter count decision point connect to a shared further decision within the feature rule. Sub Rules, unlike Sub Branches, cannot include Transformations or final rule outcomes.
Name your Sub Rule, add the logic, and click Add Sub Rule. Once saved, you’ll be directed to the version control screen of that Sub Rule.
Creating a Feature Sub Branch
From within the Feature Sub Rules screen, click Add Sub Branch and you’ll navigate to what you know as the Rule Builder.
Unlike Sub Rules, Sub Branches allow you to create rule sets with Transformations at the end of them. They allow you to group a series of outcomes into a single node within your Feature Rule.
In the example below, you’ll see a Sub Branch for a Registration Wall. Whilst a more simple rule may use a single registration form for all users, this rule uses a different registration wall (or block) depending on the device type accessing the content, allowing us to shorten the registration form for mobile users, and have more fields for desktop users. When this Sub Branch is placed within a Feature Rule, it will be seen as a single node, called Registration.
Name your Sub Branch, add the logic, and click Add Sub Branch. Once saved, you’ll be directed to the version control screen of that Sub Branch.
Versioning your Sub Rules and Branches
Like traditional Feature Rules, Global Sub Rules and Sub Branches use version control. This means that if you have created your Sub Rule or Branch under Rules > Feature Sub Rules you’ll be able to navigate back to the rule and edit or add to it as you choose.
Each time you save, a new version will be created. Creating a new version will not update the version of the Sub Rule in use within a Feature Rule. You will need to navigate to the Feature Rule and update the version number. See below for more details.
Using your Sub Rules and Branches within a Feature Rule
To use a Global Sub Rule or Sub Branch within a Feature Rule, navigate to the relevant Feature Rule and select the Sub Rule option from your Rule Builder Canvas.
When you have Global Sub Rules and Sub Branches created, you will see four options:
- Run Branch: Create a Sub Branch within the Rules Builder. Note: These are not version controlled and can only be used in a single rule.
- Run global sub-rule: Choose a Sub Rule and version from Sub Rules you have created under Rules > Feature Sub Rules.
- Run sub-rule: Create a Sub Rule within the Rules Builder. Note: These are not version controlled and can only be used in a single rule.
- Run global branch: Choose a Sub Branch and version from Sub Branches you have created under Rules > Feature Sub Rules.
When choosing one of the Global options a modal will appear over the Rule Builder Canvas. Choose the Sub Rule or Sub Branch you wish to use from the list, along with the version you wish to add to your rule.
Once selected, your Sub Rule will sit within your Feature Rule as a single node. Double click on this node to adjust the version that is in use.