behavior_restrictEmailInput_customField
Wed Nov 13 2024 17:44:11 GMT+0000 (Coordinated Universal Time)
Saved by
@belleJar
// DMP Tools Form
def cfName = getFieldByName("Communication Email")
cfName.clearError()
String cfNameValue = cfName.getValue()
// Only proceed if the field has a non-empty value
if (cfNameValue && cfNameValue instanceof String && cfNameValue.trim()) {
// Check if the value ends with the required domains
if (cfNameValue.endsWith("@acme.com") || cfNameValue.endsWith("@acmeTeam.com")) {
return // No error if the value matches the required domains
} else {
// Set error if the conditions are not met
cfName.setError("The email should end with @acme.com or @acmeTeam.com")
}
}
content_copyCOPY
restrain custom field to email address only on Intake
Comments