Welcome to Zuora Product Documentation

Explore our rich library of product information

Add your sub rule

Create a sub rule to manage the meter footer rule, display countdowns, and handle trial expirations using custom scripts and output options.

To keep the main rule simple and maintainable, the meter footer logic is implemented as a separate sub-rule. The footer displays a meter countdown based on a trial with remaining counts. As the remaining count is consumed, a script captures and stores the updated value in a variable, which is then used to track the user's progress during the trial.

To add your sub rule, complete the following steps:

  1. Navigate to the feature we created in the Build Your Feature topic as follows:
    1. Navigate to Products > Features from the main menu.
    2. Select the feature, for example, Article.
    3. Select the version to update.
  2. Select the Access segment title.
  3. Drag the Trials decision node to the rules canvas. The Trial dialog box displays. Complete this dialog box as follows:
    1. Enter 4 in the A limit of field. This limits the allowed views to four.
    2. Select Page Views from the first drop-down. This means that every view is counted toward the limit; even repeat views of the same content.
    3. Select In the last from the second drop-down. This allows you to define the duration for which the limit applies.
    4. Enter 7 in the last field. This limits the duration to seven days.
    5. Select Mid Trial Experiences .
    6. Select Add A Remaining View.
    7. Enter 4 in the Remaining Count text box. This adds a node when the meter count reaches four remaining views.
    8. Repeat the previous steps to add remaining counts of 3, 2, and 1. Your Mid Trial Experiences section looks similar to the following:
    9. Select Save . Your Trial decision node is added to the sub rule canvas.
  4. Select the Advanced segment title from the decision bar.
  5. Drag the Run Custom Script decision node to your sub rule canvas. The Custom Script dialog box displays. Complete this dialog box as follows:
    1. Enter uiComponentScope["meter"] = "4"; in the text box.
      Note: In this script, we use the variable we set up, meter , and a remaining count of four. If you used a different variable name or remaining count, these fields must be changed to match your configuration.
    2. Select Save . The Custom Script decision node is added to your sub rule canvas.
  6. Connect the 4 Remaining node from the Trial decision node to the Custom Script decision node.
  7. Repeat steps 4 and 5 to add a script for the other remaining counts and connect the other Remaining nodes to the relevant custom script decision node.
    Note: Remember to change the remaining count field to the count relevant for the script. We now have four Custom Script decision nodes on your sub rule canvas, which are connected to the related remaining count nodes.
  8. Select the Sub Rules segment title from the decision bar.
  9. Drag the Output Option decision node to your sub rule canvas. The Output Option dialog box displays. Complete this dialog box as follows:
    1. Enter In Trial in the Title text box.
    2. Click Save. The In Trial output option is added to the sub rule canvas.
  10. Connect the In Trial node of the Trials decision node and all the Custom Scripts to the In Trial output option.
  11. Drag another Output Option decision node to your sub rule canvas. The Output Option dialog box displays. Complete this dialog box as follows:
    1. Enter Trial Expired in the Title text box.
    2. Select Save . The Trial Expired output option is added to the sub rule canvas.
  12. Connect the Trial Expired node of the Trials decision node to the Trial Expired output option Your rule looks similar to the following: Sun rule sample
  13. Click Done to save your sub rule and return to your main rules canvas.