Defining Conditions
Conditions are JavaScript expressions which are applied to Actions, defined on the Reception Rules tab. This topic is intended to be used as a general guide to writing Conditions for use in the reception rules, combined with a basic knowledge of JavaScript and general coding principles. In particular, it discusses:
-
The case attributes available to the Condition;
-
An overview of the JavaScript operators most likely to be of use when writing Conditions.
Attributes for Use in Conditions
Conditions are designed to be used to test various characteristics of incoming Cases, to determine whether or not to apply a given Action to the Case.
There are three types of attributes available when defining Conditions:
-
Standard Case Processing Parameters
-
Workflow Defined Parameters
-
Case Data Properties
Standard Case Processing Parameters
The standard case processing parameters are common to all cases (and alerts). They provide information about what has changed in the case before it is presented to reception. These are:
Table 1-27 Standard Case Processing Parameters
Name | Values and Meaning |
---|---|
|
|
|
Note: for Match processes, the update key includes all attributes mapped to the case source. |
|
|
|
|
Workflow Defined Parameters
Workflow defined parameters are defined in the Parameters tab of the Workflow editor, and populated using selection functions configured in the Case Source. As such, they are specific to the workflow and case source of the Case.
There is a single implicit workflow parameter, MatchPriorityScore
. If you define a parameter with the name 'matchPriorityScore' in the workflow, it will be populated automatically by the case creation process.
Case Data Properties
Case data properties are the public properties available on the Java Bean object representing the Case. Case data properties are accessed from the JavaScript using the following syntax:
caseData.<property name>
For example, the currentState property is accessed as caseData.currentState
.
The available case data properties are as follows:
Table 1-28 Case Data Properties
Name | Type | Description |
---|---|---|
|
Integer |
The internal identifier of the case. |
|
String |
This property is always set to "match", representing a Case that has been generated from a Match processor. Other values may be used in the future, as alternative case generation mechanisms are introduced. |
|
String |
This property can have the following values:
|
|
String |
The external identifier of the case. This is composed of the prefix defined by the case source plus a sequence number. For example, for a case source with the prefix "DSAN": "DSAN-1123". |
|
String |
A naturally sortable version of |
|
String |
The Case Key. |
|
String |
A human-readable version of |
|
Integer |
The internal identifier for the parent case. If this is a root case, it will be set to -1. |
|
String |
The key used to test whether the |
|
String |
Reserved for future use. |
|
String |
The key used to test whether |
|
String |
The case description. |
|
Integer |
The user id of the user who created the case. |
|
Date |
The timestamp from when the case was created. |
|
String |
The user id of the user who last modified the case. |
|
Date |
The timestamp from when the case was last modified. |
|
Integer |
The user ID of the user to whom the case is currently assigned. If the case is currently unassigned, this property will be set to -1. |
|
Integer |
The user ID of the user who last assigned the case. If the case is currently unassigned, this property will be set to -1. |
|
Date |
The timestamp from when the case was last assigned. |
|
Integer |
Numerical representation of the case priority. The possible values are: 0 = None 250 = Low 500 = Medium 750 = High |
|
String |
Permission required in order to view the case. If no permission is required, this property will be null. |
|
String |
The name of the current state, as defined in the workflow. |
|
String |
For cases, this will be set to one of "New", "In Progress" or "Complete". For alerts, it is set to null. |
|
Date |
The time at which the current state will automatically expire. |
|
Integer |
The user ID of the user who last changed the state of the case. |
|
Date |
The time at which the state was last changed. |
|
String |
A string value created by the case generator to uniquely identify the originator of the case. For example, a match processor will be represented by <process id>_<processor num>. |
|
String |
The name of source used to create the case. |
|
Integer |
This property indicates whether or not the flag is set for the case, as follows: 0 - the case is not flagged, 1 - the case is flagged |
|
Integer |
The user ID of the user who last set the case marker. |
|
Date |
The time at which the case marker was last set. |
|
String |
A sortable column which can be used to identify all the cases and/or child cases belonging to the same ancestor. |
|
Integer |
The level of a child case within a group. |
|
String |
The value of ExtendedAttribute1. |
|
Integer |
The user ID of the user who last changed the value of the extended attribute. |
|
Date |
The time at which the extended attribute value was last changed. |
JavaScript Operators
A Condition should evaluate to a Boolean expression - true
or false
. As such, the operators most likely to be of use are the conditional operators, which test concepts such as 'less than' or 'greater than or equal to', and the logical operators, which represent logical operations such as AND, OR and NOT. The following tables present a quick reference guide to the JavasScript conditional and logical operators:
Conditional Operators
The following table outlines the conditional JavaScript operators, and includes an example of how each one evaluates for a statement involving a variable x, where x is set to 5.
Table 1-29 Conditional Operators
Operator | Description | Example |
---|---|---|
== |
Is equal to |
x==8 evaluates to false |
=== |
Is exactly equal to, accounting for both value and type |
x===5 evaluates to true x==="5" evaluates to false |
!= |
Is not equal to |
x!=8 evaluates to true |
> |
Is greater than |
x>5 evaluates to false |
< |
Is less than |
x<8 evaluates to true |
>= |
Is greater than or equal to |
x>=5 evaluates to true |
<= |
Is less than or equal to |
x<=8 evaluates to true |
Logical Operators
The following table outlines the conditional JavaScript operators, and includes an example of how each one evaluates for a statement involving two variables x and y, where x is set to 6 and y is set to 3.
Table 1-30 Logical Operators
Operator | Description | Example |
---|---|---|
&& |
Logical AND. Both elements must evaluate to true for the whole expression to be true. |
(x>10 && y>1) evaluates to false |
|| |
Logical OR. Either (or both) elements must evaluate to true for the whole expression to be true. |
(x==6 || y==6) evaluates to true |
! |
Logical NOT. Evaluates to true if the original expression is false, and vice versa. |
!(x==y) evaluates to true |