Using Random Rule and Sampling Rule Steps
  • 11 Feb 2021
  • 3 Minutes to read
  • Dark
    Light

Using Random Rule and Sampling Rule Steps

  • Dark
    Light

Article Summary

Overview

The Random Rule and Sampling Rule components provide a way to test for probability within a Flow. Within set boundaries, both components randomly return one of two outcomes "True" or "False." The random outcomes can be weighted by configuring the Percentage of times that the outcome will be True.

To guarantee the ratio of "True" to "False" outcomes, the Sampling Rule offers an additional option for configuring the sample size via the Sample Key Input.


Example

This example flow will choose to follow one of three paths. About 50% of the time it will follow the path to send a Customer Satisfaction Survey. If the Flow does not follow the path to send a Customer Satisfaction survey, it will choose to either send a "Thank You" Email or send an Email containing a "Coupon".

The sample size for this second choice is 10. This means that if the Flow chooses to follow the path to send a "Thank You" Email containing a "Coupon" five times, it will not choose that path again until it has chosen both paths a total of 10 times. The same remains true when the options are reversed.

2019-06-27_1559.png

  1. From a Designer Project, select CREATE FLOW. Then, choose Flow, provide a Name, and click CREATE.
  2. Attach a Random Rule step from the RULES category of the Toolbox tab, to the Start step. 
  3. Navigate to the Random Rule step's Properties to ensure that Percent True is set to 50. 
  4. From the FAVORITE STEPS category of the Toolbox tab, attach a Send Email step to the True path of Random Rule step. 
  5. Navigate to its Properties tab and configure its EMAIL values, providing a From, To, Subject, and Message value. Connect the Sent path to the End step. 
    This Email will serve as the Email that provides the Customer Survey link.

    Due to the Random Rule's Percent True value being set to 50, the Flow will send this Email 50% of the time it is run.

  6. From the RULES step category, attach a Sampling Rule step to the False path of the Random Rule step. 

    This step is used to determine with to send a basic "Thank You" Email, or one containing a "Coupon".
  7. From the Properties tab of the Sampling Rule step, set Sample Key to 10. Leave the Percent True value at 50. 

    This value dictates the sample size and that or every 10 times the Flow crosses this path, the Sampling Rule will send the "Coupon" Email five times. After the Flow reaches these five instances, it will not send the "Coupon" Email again until both paths of the Sampling Rule have been reached 10 times.

  8. Attach a Send Email step to the True path of the Sampling Rule, and configure its EMAIL values accordingly. Connect its Sent path to the End step. 

    Configure this Email as the basic "Thank You" Email. 

  9. Attach a Send Email step to the False path and configure its EMAIL values. 

    Configure the Email send the "Coupon" Email. 

  10. Save the Flow, then if desired close via X.



Debug 

  1. From the Flow Designer, select the Debug link from the top Action bar.
  2. Click START DEBUGGING.
  3. After the Flow runs, click CREATE NEW SESSION to repeat the process until all desired results have been reached.
    In the first Debug Session, Random Rule returned the True outcome, directing the Flow to send the Customer Survey Email. 

    In the second Debug Session, Random Rule returned the False outcome, therefore directing the Flow to the Sampling Rule.

    Upon reaching the Sampling Rule, a False Outcome also occurred, directing the Flow to send the Coupon Email.

    For the next ten times that Random Rule has a False outcome, the Sampling Rule will be given the option to randomly return either a "True" or "False" outcome. By the tenth time, however, it will have chosen both outcomes exactly five times.



Was this article helpful?