List Container Rules
  • 30 Jun 2022
  • 2 Minutes to read
  • Dark
    Light

List Container Rules

  • Dark
    Light

Article summary

List Container Rules are implemented in Decisions in the Rule Engine. These Rules are designed to process a list of items and apply desirable conditions to each item in the list. The List Container Rules have three options:

  • Contains All – Each item in the list should satisfy the condition for Rule to evaluate as True.
  • Contains Any – At least one item in the list should satisfy the condition for Rule to evaluate as True.
  • Does Not Contain Any – None of the items on the list should satisfy the condition for Rule to evaluate as True.


Example

In this example, the Rule will take in an array of Accounts. It should evaluate as True if all Accounts in the array have an email address that contains “decisions”. This example requires List Container Rules to test each Account in the array. Below is a downloadable example to import into Decisions.


  1. In a Designer Folder, select CREATE RULE from the top action bar. When the Create Rule window appears, select Statement Rule, enter a name for the Rule (List Container Rule) and click CREATE.
  2. In the Rule Designer, select SETUP INPUT DATA.
  3. Click DEFINE under Define Input Data on the Rule Input Data dialog box that appears.
  4. To set up the data, enter Accounts in the Name field. Next, click the dropdown list under Type and search for "account". Select Account and click PICK.
  5.  Next, check the Is List checkbox, this will enable this data to be an array that will display the Contains All, Contains Any, or Does not Contain Any as options when selecting the condition to check.
  6. Click Save then close the Input Data Designer window.
  7. Click the Select Data Element dropdown. Choose Accounts then click NEXT.
  8. Choose the Contains All option under the List Container Rules category and select NEXT.
  9. Under the Collection Information category, in the Each List Item Name field, enter "Email" as the Item Name and select DONE.
  10.  Click CLOSE to save the Rule statement.
  11. In the new If Statement block, click Add and then choose Add Condition. Each item passed through the Rule will need to pass this condition that will check to see if Account.EmailAddress contains "decisions".
  12. Click Select Data Element, click Email, then scroll down to select EmailAddress [String]. Click NEXT.
  13. Select the Contains option under the Text Rules category then click NEXT.
  14. Under the Inputs category, enter "decisions.com" as the value and select DONE.
  15. Click CLOSE to save the Rule and return to the Rule Designer.

Debug

  1. To ensure the Rule works, select Debug on the top panel of the Rule Designer.
  2. To add accounts to test, click ADD NEW under Accounts.
  3. Enter a name in the Name field. Under the Settings category, enter an email address under the EmailAddress field.
  4. Click DEFINE to save.
  5. After adding the desired number of accounts, click START DEBUGGING.
  6. The Rule runs and stops at the first False result evaluating the entire Rule as False since the Rule was built using the Contains All option and the email that was first found did not match the condition.


For further information on Rules, visit the Decisions Forum.

Was this article helpful?