Setting Up Interceptor Pattern
- Updated on 29 Sep 2016
- 2 minutes to read
Note : in order to use Rule Sets and Interceptor Rules , Decisions.FlowSets Module should be installed. To learn how to install Module in Decisions please click here .
This tutorial demonstrates how to set up Interceptor Pattern in Decisions 4.0.
Interceptor Pattern is a process of validating data in a workflow, stopping workflow on invalid data, and storing intercepted data for further analysis and user interactions.
In this example simulate a process that needs Interceptor Pattern implementation.
Begin in the Designer Folder with clickingCreate Flow button on the Folder Actions Panel.
Then, Name the Flow and select Create to proceed to theFlow Designer.
Add Fetch Entities step from the Steps panel. Configure the Type Name to be Account[DecisionsFramework].
Next, add a ForEach Step .
The ForEach step Type needs to be set as Account and the collection is the EntityResults that is passed from the FetchEntities step.
On the Next path from the ForEach step, add a Run Rule Set step.
Next, select Run Rule Step on the work-space and select All > Create Rule Set on Edit Step Actions Panel.
In the resultingCreate Rule Set window, Name the Rule Set , select Current Row Flow data to be exposed as Rule Set input and select Ok to save and continue.
The Rule Set Folder opens in a new window. OnFolder Actions Panel, select Setup Rule Set .
In theRule Set Settings, scroll down to Rule Types Section and check Allow Interceptor Rules check-box. This allows the creation of Interceptor Rules in this Rule Set . Select SAVE to save and continue.
Back in the Rule Set Folder we click Add Rule > Intercept on Folder Actions Panel.
Then, Name the Rule and select Create Rule to proceed to the Rule Designer.
In the Rule Designer, build a Rule that is going to intercept an Account with empty First Name.
See that Item data is available in theRule Designer because this Rule is a part of the Rule Set. Expand Item , pick FirstName and select Next .
In the verb definition window choose Is Empty and select Done .
This completes the Interceptor Rule . Save the Rule and close Rule Designer.
Next, navigate back to our flow . Run Rule Set step needs Rule Set Run Name to be configured. This setting is required because it will indicate a Name of intercepted data. In this example, configure it using Text Merge Plain Mapping Type. Use Item.EmailAddress.
Then, we save the Flow and select Debug .
Our Rule Set Folder opens in a new window. OnFolder Actions Panel we click Setup Rule Set .
Then, we navigate to our Rule Set Folder.
In the Rule Set Folder System created Rule Set Results sub-folder to store our Rule Set Data . We navigate to Rule Set Results.
In the Rule Set Results Folder we can see that our Interceptor Rule stored one Record (first row in the excel file) because Full Name was empty. At this point our Process Flow is stopped on the First Record from excel file before Add Record To External System step. Intercepted Data is stored. Interceptor Pattern will continue Process Flow after we implement Full Name Empty intercepted data handling.