Rule Extensions Using Rule Engine

Last Updated: 10/03/2018 Introduced in Version: 2.0

This tutorial demonstrates how to use Rule Extensions in a Rule Engine. A Rule Engine Extension allows you to create a Rule that can be embedded in another Rule. It is required to add “anchor” Input in the “Main” Rule in order to use Rule Engine Extension. This “anchor” Input should be the same Type of Data that Extension Rule has as its Rule Input Data. 



In this example, create a Flow that should validate “if the Account in the Portal belongs to the Decisions Employee?”, and then, display all Accounts that passed this validation. In order for the Account to pass validation, it should contain in the Email Address field. Additionally, it should have a specific Address in the Contact Info, because Address is a complex Data Type, create a Rule Extension that checks if the Address is valid for the Account.


Defined Data Structure

First, we need to create a Defined Data Structure. In the Designer Folder select Datatypes/Integrations > User Defined Types > Defined Data Structure option from Folder Actions. Name the Defined Data Structure Address and add four Data Names. Select Save to save and close Add DefinedDataStructures (Figure 1).

  • Name: City
    • Type: String
  • Name: State
    • Type: String
  • Name: Street
    • Type: String
  • Name: Zip
    • Type: String

Figure 1


Rule Engine Extension

Next, create an Extension Rule. In the designer Folder navigate to Create Rule >Statement Rule and select Rule Engine Extension.  Next name the Rule and proceed to the Rule designer (Figure 2).

Figure 2


Locate the Properties Tab and in the Output settings under the Behavior Type select Rule Engine Extension (Figure 1). In the Rule designer Select Data Element to choose  Rule Input Data (Figure 3).

Figure 3



Select Show Editor to Add Rule Input Data (Figure 4). 

Figure 4

Name the Input and select Address Data Structure that we have created for this tutorial as its Type. Select Close to save and continue (Figure 5).

Figure 5



In the Rule Phrase Builder, expand and select to build a Rule Phrase. This example uses the phrase “Address City is Chesapeake” to evaluate. Each phrase is added by selecting Add New Rule Step (Figure 6).


Add New Rule Step

Figure 6


Add a Rule Phrase for each of the Data Members in the Address Data Structure. When the Rule Phrase is complete it will accept Address Data and return True if all Data Members match the desirable Address. We can save the Rule and close Rule Designer (Figure 7).


Phrase Builder

Phrase 1: Address City is Chesapeake

Phrase 2: Address State is Virginia

Phrase 3: Address Street is 821 Battlefield

Phrase 4: Address Zip is 23322

Figure 7




Create Rule

Next, create the “main” Rule that will use an Extension Rule. In the designer Folder select Create Rule > Statement Rule and Select Default. Then, Name the Rule and select Create to proceed to the Rule Designer (Figure 8).

Figure 8


In the Rule designer’s Properties Tab in the Default Section under Rule Input Data select Show Editor and add Rule Input Data (Data Definitions) to the Rule (Figure 9).

Figure 9


Create a Data Definition called Account Address for the Rule Input Data. The Rule Input Data (Account address) should be the same Type as the Input Data for the Extension Rule (Address [RuleExtensionUsing]).
The Rule Input Data will be an “anchor” for the Extension Rule. Select Close to save and continue (Figure 10).


Figure 10


In the Rule designer begin building the Phrase Builder. Choose Account Address “anchor” Input Data and select Next. Next to Account Address Pick Verb, expand Common>Rule/Flow Extensions (Account Address), (Figure 11).

Figure 11


Next, in Pick Verb expand Rule Engine Extensions and pick the Extension Rule as a verb for this Rule Phrase. Select Next to continue (Figure 12).

Figure 12



The Extension Rule does not take any additional Input Parameters, therefore we select Done to complete this Rule Phrase (Figure 13).



Figure 13

When the Rule Phrase is run or built into a Flow it will run the “Main Rule” using the Rule Engine Extension as its Parameters. This complete the example on how to create a Rule Engine Extension that is embedded into a Rule. 



Creating Custom Rule Verbs Using Rule Engine Extension

Creating Defined Data Structures Advanced


Additional Resources