Use activity pattern codes instead of public IDs in comparisons
As a performance best practice, Guidewire recommends
that you always use activity pattern codes (Activity.Pattern.Code) in comparison
expressions for conditional processing and in queries. Comparisons of
activity patterns by codes frequently avoid database reads to evaluate
the expression.
The following sample Gosu code suffers
a performance problem. The comparison with Activity.Pattern by public ID
cc:12345 always requires
a database read to evaluate the expression.
if (Activity.ActivityPattern == ActivityPattern("cc:12345")) { // Comparisons of activity pattern
// public IDs always require a
} // database read.
The following sample Gosu code improves performance
by comparing Activity.Pattern.Code
with an activity pattern code in the conditional expression.
if (Activity.ActivityPattern.Code == "MyActivityPatternCode") { // Comparisons of activity pattern
... // codes generally avoid a
} // database read.
Never localize activity pattern codes. These codes are intended for use in Gosu expressions, not for display in error messages of the application user interface.
See also
