Understanding Gosu rule conditions

The simplest kind of condition looks at a single field on the object or business entity. For example:
  • activity.ActivityPattern.Code == "AuthorityLimitActivity"

This example demonstrates some important basics:

  1. To reference an object (for example, an Activity object, or, in this case, an ActivityPattern object) and its attributes, you begin the reference with a root object. While running rules on an activity, you reference the activity in question as Activity. Other root objects, depending on your Guidewire application, are Account, PolicyPeriod, Producer, Invoice, TroubleTicket, and Charge.
  2. PolicyCenter uses dot notation to access fields (for example, Activity.ActivityPattern) or objects (Activity.ActivityPattern.Category, for example), starting from the root object.

Combining rule conditions

For more complicated conditions, you can combine simple conditions using standard Boolean logic operators (and, or, not). For example:
  • activity.ActivityPattern.Code == "AuthorityLimitActivity" and not activity.Approved
Important: The rule condition statement must evaluate to either Boolean true or false. If you create a condition statement that evaluates to null, PolicyCenter interprets this as false. This can happen inadvertently, especially if you create a condition statement with multiple conditions to evaluate. If your condition evaluates to null (false), PolicyCenter never executes the associated rule actions.

Defining a statement list as rule conditions

It is also possible to use a statement list, instead of a simple expression, in the CONDITION block. Every CONDITION block must contain a return statement that evaluates to a Boolean value of true or false. For example:

var o = new HashSet<IType>() {A, B, C, ...}
return o.contains(typeof(...)) 

See also