Rule Extensions Using Rule Engine
  • Updated on 05 Mar 2019
  • 3 minutes to read
  • Print
  • Dark
    Light

Rule Extensions Using Rule Engine

  • Print
  • Dark
    Light

This tutorial demonstrates how to use Rule Extensions in a Rule Engine . A Rule Engine Extension allows you to create aRule 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.

EXAMPLE

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 decisions.com in theEmail Address field . Additionally, it should have a specific Address in the Contact Info, because Address is a complex Data Type, create aRule Extension that checks if the Address is valid for the Account.

Defined Data Structure

First, we need to create a Defined Data Structure . In theDesigner 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.

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

address-rule-engine.jpg

Rule Engine Extension

Next, create an Extension Rule . In the designer Folder navigate toCreate Rule >Statement Rule and selectRule Engine Extension. Next name the Rule and proceed to the Rule designer.
2018-10-01_105340.jpg

Locate the Properties Tab and in the Output settings under the Behavior Type select Rule Engine Extension . In the Rule designer Select Data Element to choose  Rule Input Data.
2018-10-01_105758.jpg

Select Show Editor to Add Rule Input Data
2018-10-01_105959.jpg

Name the Input and select Address Data Structure that we have created for this tutorial as its Type . Select Close to save and continue.
address-Rule-Extension.jpg

In theRule 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

Add New Rule Step

Add-new-Rule-step.jpg

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.

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
2018-09-28_145438.jpg

Create Rule

Next, create the "main" Rule that will use anExtension Rule. In the designer Folder select Create Rule > Statement Rule and S elect Default. Then, Name the Rule and select Create to proceed to the Rule Designer.
Validate-employee.jpg

In the Rule designer's Properties Tab in theDefault Section underRule Input Data selectShow Editor and add Rule Input Data (Data Definitions) to the Rule.
Validate-Employee-2.jpg

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

Accountaddress.jpg

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).
account-address.jpg

Next, in Pick Verb expand Rule Engine Extensions and pick theExtension Rule as a verb for this Rule Phrase . Select Next to continue.
rule-address-extension.jpg

TheExtension Rule does not take any additional Input Parameters, therefore we select Done to complete this Rule Phrase.

rule-engine-done.jpg

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.

Was this article helpful?