Rules and Rule Sets

From AgileApps Support Wiki
Revision as of 00:48, 31 October 2012 by imported>Aeric (Text replace - 'Case Dynamics' to '{{HelpDesk}}')

A Rule is an if-then statement that says, if one or more conditions are met, then take one or more specified actions. A Rule Set is a collection of such rules.

About Rules and Rule Sets

The Template:HelpDesk interface makes it easy to define rules by selecting fields and specifying matching criteria. When satisfied, the criteria causes any and all actions associated with the Rule to be carried out.

Rules are defined in Rule Sets. Both Rules and Rule Sets can return a value, or simply carry out one or more actions. When satisfied, a Rule can cause processing of the current Rule Set to stop (after taking associated actions), or it can allow processing of the Rule Set to continue with the next Rule in the series.

Rule Set Chaining

Rule Sets can be chained, which means that a Rule can cause a different Rule Set to be processed. When that Rule Set finishes, the processing of the original Rule Set resumes where it left off. (Chaining can go to an arbitrary depth.)

Rule Actions

Each Rule can carry out multiple actions. Here are the actions that a Rule can perform:

  • Change Status - Change the status of a Case--for example, to mark it completed
  • Change Record Owner - Determine the new owner of the Case record
  • Complete Milestone - Mark a processing stage as completed
  • Execute Rule Set - Chain to a different Rule Set, and execute those Rules
  • Invoke Method - Invoke a method in a Java Class
  • Post Message in Relay - Deliver a message to a social-networking Relay feed
  • Send Email - Send a message, optionally using an Email Template
  • Return Expression - Return a value defined by an expression
  • Designate a User or Role - Select a user or role. Usually used to determine who is responsible for the case, or for the next step in its handling
  • Return Java Method Results - Return a value generated by a method in a Java Class
  • Update Record - Make a change to the Case record

Working with Rules and Rule Sets

Creating or Modifying a Rule Set

  1. Go to Designer > Case Types > {case type} > Rule Sets
  2. Click [New Rule Set], or visit an existing one
  3. Fill in the Rule Set properties, below
  4. Click [Save]

Rule Set Properties

  • Title - The title you'll see when referencing the Rule Set in the Template:HelpDesk interface.
  • Name - The name used by programmers. A default version of the name is created from the title, but it can be edited, if desired.
  • Enabled - Whether or not the Rule Set is currently in force. (Disable a Rule Set to temporarily deactivate it, without deleting it.)
  • Use for Inbound Emails - The rules will operate on incoming email messages. (Email fields like To and Subject will be available for processing.)
Learn more: Email to Case
  • Return Type - If the Rule Set will return a value, specify the type of value -- Boolean (true/false), Number, String, Date, a User/Role, or None.
  • Description - Write a descriptive summary here.

Rule Set Example

Here's a sample Rule Set that is intended to determine the owner for a case:

File:CaseDynamicsRuleSetExample.png

Creating or Modifying a Rule

Once a Rule Set is created, you can add Rules to it.

  1. Go to Designer > Case Types > {case type} > Rule Sets
  2. Click [New Rule Set], or visit an existing one
  3. Click [New Rule]
  4. Define the Rule, as shown below
  5. Click [Save]

Basic Information

  • Name - The name of the Rule, displayed in the Template:HelpDesk interface.
  • Enabled - Whether or not the Rule is enabled. (Disable the rule to deactivate it without deleting it.)
  • Description - A descriptive summary
  • On Success - Whether toStop processing other rules in the Rule Set, when these Rule conditions are satisfied, or whether to Continue processing other Rules.

IF clause

  • Specify Criteria Using the Condition Builder-
Use this option to specify a series conditions that determine whether the Rule's actions are carried out.
  • All of the Conditions are met - Every condition in this category must be satisfied
  • Any of the Conditions are met - At least one of the conditions in this category must be satisfied.
For example, here is a sample Rule that says for a new Priority 1 & 2 incident, return the Incident Manager role. (Other rules could return different values. The collection of rules in the Rule Set could then be used to determine Case ownership.)
File:CaseDynamicsRuleExample.png
  • Specify Criteria Using the Expression Builder -
More complex conditions can be specified using the Expression Builder. For example, here is the expression constructed from the conditions selected in the previous example:
File:CaseDynamicsRuleExpressionExample.png

THEN clause

  • Click [Add Action] for each of the Rule Actions you want to carry out when the Rule conditions are satisfied.

For Programmers

This information is intended for System Developers. Solution Designers can largely ignore this section.

Designating a User or Role

In general, a Solution Designer simply chooses a User or Role as the return value for a Rule. But it is also possible to return a "user expression" using Java code. That expression is a string that has the form:

r: {role_id}, or
u: {user_id}
Considerations
  • The space before the Role ID or User ID is optional.