Configuring class-based validation
Through the Gosu validation classes, Guidewire provides methods to help you write checks to determine if one of the policy-specific entities is passing validation at a certain priority level.
For example, you can use the following code to check if the validation level being tested is at least at the bindable level:
if Context.isAtLeast(TC_BINDABLE)Depending on the result of your validation checks, you can configure PolicyCenter to display an error or warning message to the user.
To illustrate, suppose that one class-based check validates that an underwriting company must be assigned before binding a policy. Thus, you define the following condition in a validation class to enforce the constraint and generate an error message in PolicyCenter if the condition is not met.
var atBindable = Context.isAtLeast(TC_BINDABLE)
if ( (Period.UWCompany == null) && (atBindable == true) {
Result.addError(Period, "bindable", DisplayKey.get("Web.Policy.errorMessage")
}
PolicyCenter displays an error if both are
true.
