Creating Custom Rules

Custom rules allow administrators to implement flexible business logic and process activities by using information from external sources. Activity and customer context is passed to the custom rule in the form of RuleContext object.

Before custom rules can be used in workflows, they must be created and compiled.

Creating Custom Rules

The following must be completed while creating custom rules. Every custom rule must:

  • Extend the CustomRule class.

  • Have a default constructor. This default constructor must invoke the constructor of CustomRule class.

  • Implement the public int applyRule(RuleContext oContext) method.

A sample custom rule looks like:

import com.egain.platform.module.routing.CustomRule;

import com.egain.platform.module.routing.service.RuleContext;

public class TestRule extends CustomRule {

       TestRule() {

              super();

       }

       public int applyRule(RuleContext oContext) {

              return NO_ERROR;

       }

}

Compiling Custom Rules

After the custom rules have been created, they must be compiled to be able to use them in workflows. Consult your system administrator for details.

Configuring the Custom Rule Node

Configuring Custom Rule Node for Synchronous Applications

To configure a custom rule node:
  1. In the Edit Workflow page, on the Diagram tab, add the Custom Rule  node in the Workflow Editor. 
  2. In the Select Custom Rule window, provide the following details:
    • Name: Enter a name for the custom rule node.
    • Registered Application: Select an application from the dropdown. The dropdown lists only registered external Synchronous applications.
    • Selected Event Attributes: Click the Add button_add button and select event attributes from the list.
  3. Click Done to close the window.

configure_custom_rule_node

Related Topics