Rule Extensions
  • 25 May 2022
  • 2 Minutes to read
  • Dark
    Light

Rule Extensions

  • Dark
    Light

Article Summary

Overview

The Rule Engine can be extended by developers to create custom Rule verbs that can be embedded into a Statement Rule

These custom verbs can be created either through a Flow or Statement Rule and are anchored to the datatype used as inputs to these elements. When the datatype is selected in a Rule, the Rule Extensions will appear under the Custom header when choosing the verb.


Creating a Rule Extension

To create a Rule Extension, in a Designer project, click on CREATE RULE. In the gallery, select Rule Extension and select either option to create a new Rule Extension. The name for the Rule Extension will become the name for the custom verb.


Rule Extension using a Rule

The following example will create a Rule Extension that determines if the account executing the Rule contains admin and is part of the Testing Department.

  1. Create a new Rule Extension using Rule Extension [Statement Rule]. Enter a Name and click Create. 
  2. The Rule Designer will open. Click SETUP INPUT DATA.
  3. Define an input then Save. For this example, the Account datatype was used. 
  4. Define the statements for the Rule using the input then Save and close the Rule Designer.
  5. Create a new Rule.
  6. For Select Data Element. select an input that matches the inputs needed for the Rule Extension. In this case, it will be an Account. Click Next.
  7. When picking the verb, under the Custom header, select the configured Rule Extension, then click DONE
  8. Select DONE due to no additional inputs being needed.
  9. Select Debug in the Action bar to test the Rule. Selecting the Rule Extension in the debugger will display the results.


Rule Extension using a Flow

The following example will create a Rule Extension using a Rule Extension Flow to check if the account executing the Rule has an email address in a specific list.

  1.  Create a new Rule Extension using Sequential Rule Extension [Flow]
  2. The Flow Designer will open. Select the SETUP INPUT DATA action.
  3. Define the input, for this example, a String named Email Address is used.

  4. Design a Flow that will be used to evaluate the Rule input. For this example, Add a Create Data step.
  5. Define two inputs, a List of Strings labeled Email List, and a Boolean labeled output. 
  6. Under Data > Texts in the Toolbox, add a String is in List step to the workspace. Configure the step to using Email Address and Email List as inputs.
  7. For each path, add a Mapping step to alter the output to either be True or False.
  8. Map the output value to the Result in the End step. Save and close the Flow Designer.
  9. Create a new Rule.
  10. Use an input that matches the configured datatype of the Rule Extension, in this case, a String. Select NEXT
  11. When picking the verb, under the Custom header, select the configured Rule Extension, then click NEXT
  12. Since no additional parameters are being passed, select DONE.

  13. Debug the Rule. The Rule will return either True or False depending on the Result of the Flow.


For further information on Rules, visit the Decisions Forum.

Was this article helpful?

What's Next