Constructing Error Text Strings
Guidewire recommends that you use the DisplayKey class to return the
value to use for the strErrorReason
and strWarningReason.
For example, the following code returns the message, “User has duplicate
roles”.
USES:
uses gw.api.locale.DisplayKey
CONDITION (...):
...
ACTION (...):
DisplayKey.get("Java.Admin.User.DuplicateRoleError")
This also works with display keys that require a parameter or parameters. For
example,
display_languageCode.properties
defines the following display key with placeholder {0}:
Java.UserDetail.Delete.IsSupervisorError = Cannot delete user because that user is the supervisor
of the following groups\: {0}
Code DisplayKey.get("Java.UserDetail.Delete.IsSupervisorError",
GroupName) then returns
the message (with the rule retrieving the value of
GroupName already):
Cannot delete user because they are supervisor of the following groups: Western Region”
