i18n for Custom Warning or Validation Messages
You can use the Translations API to implement translations for custom validation or warning messages. For more information, see
Translations APIs in
Max for Developers.
package com.servicemax.dc.validator
import com.servicemax.core.annotations.Application
import com.servicemax.core.validator.OperationValidator
import com.intalio.core.translation.TranslationFactory
@Application(application = 'svmx_dispatch_console')
class CustomAppointmentValidator extends OperationValidator {
@Override
public Object realValidator(Map<String, Object> parameters) {
def job = recordUnderValidation.svmx_related_to
if (job.svmx_preferred_start_time < recordUnderValidation.svmx_start_datetime) {
def translatedMessage = TranslationFactory.getByFullIdentifier("dev_the_appointment_start_time_is_greater_than_preferred_start_time")
this.addRecordValidationWarning(translatedMessage)
}
}
}
For more information: