Hello,
I want to have a validation for an optional field that has exactly 8 digits.
My code is:
// Import Regex
import java.util.regex.*;
// Construct The Pattern to Match on
Pattern pattern = Pattern.compile("([0-9]){8}");
// Check if the PhoneNumber Field is a match
cfValues['PhoneNumber'] == null || pattern.matcher(issue.getCustomFieldValue(customFieldManager.getCustomFieldObjectByName("PhoneNumber")).toString())
The problem is that allows can insert more than 8 digits.