1.2.5.4.9 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

newCase

true - the case has just been newly created

false - an existing case has been updated

updateKeyChanged

true - values in the update key have changed

false - values in the update key have not changed

Note: for Match processes, the update key includes all attributes mapped to the case source.

flagKeyChanged

true - values in the update key have changed

false - values in the update key have not changed

fromImport

true - the case has been imported through the Match Decisions import.

false - the case is not from an import.

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

id

Integer

The internal identifier of the case.

caseGroup

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.

caseType

String

This property can have the following values:

case - indicates a case.

issue - indicates an alert.

externalId

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".

externalIdSort

String

A naturally sortable version of externalId.

caseKey

String

The Case Key.

keyLabel

String

A human-readable version of caseKey.

parentId

Integer

The internal identifier for the parent case. If this is a root case, it will be set to -1.

supplementaryId

String

The key used to test whether the updateKeyChanged should be set to true.

supplementaryType

String

Reserved for future use.

flagKey

String

The key used to test whether flagKeyChanged should be set to true.

description

String

The case description.

createdBy

Integer

The user id of the user who created the case.

createdDateTime

Date

The timestamp from when the case was created.

modifiedBy

String

The user id of the user who last modified the case.

modifiedDateTime

Date

The timestamp from when the case was last modified.

assignedUser

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.

assignedBy

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.

assignedDateTime

Date

The timestamp from when the case was last assigned.

priority

Integer

Numerical representation of the case priority. The possible values are:

0 = None

250 = Low

500 = Medium

750 = High

permission

String

Permission required in order to view the case. If no permission is required, this property will be null.

currentState

String

The name of the current state, as defined in the workflow.

derivedState

String

For cases, this will be set to one of "New", "In Progress" or "Complete". For alerts, it is set to null.

stateExpiry

Date

The time at which the current state will automatically expire.

stateChangeBy

Integer

The user ID of the user who last changed the state of the case.

stateChangeDateTime

Date

The time at which the state was last changed.

sourceId

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>.

sourceName

String

The name of source used to create the case.

caseMarker

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

updatedBy

Integer

The user ID of the user who last set the case marker.

updatedDateTime

Date

The time at which the case marker was last set.

groupId

String

A sortable column which can be used to identify all the cases and/or child cases belonging to the same ancestor.

groupLevel

Integer

The level of a child case within a group.

customFlag1

String

The value of ExtendedAttribute1.

customFlag1By

Integer

The user ID of the user who last changed the value of the extended attribute.

customFlag1DateTime

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