Support Article
Telephone: Invalid value specified for Telephone
Summary
While creating an operator, user does not provide the phone number since it is not mandatory as per the requirement. However, the user must enter a valid phone number during creation since the ValidPhoneNumber Edit Validate is used for the pyTelephone property. Error occurs when an operator without a phone number is opened from Pulse where the operator is tagged (View profile).
Error Messages
Telephone: Invalid value specified for Telephone. Value doesn't adhere to the Validate: ValidPhoneNumber
Steps to Reproduce
- Create an operator without providing a phone number.
- Add the ValidPhoneNumber Edit Validate for the pyTelephone property.
- Tag the operaor in a Pulse comment. View the operator profile.
Root Cause
While viewing the profile, the final out-of-the-box pzSetOrganizationLabels rule sets the value as 'N/A' in the Telephone property which is empty. However, the Edit Validate rule does not allow 'N/A'. The code only allows digits and '-', and no other alphabets. Hence, the validation fails.
Resolution
Perform the following local-change:
- Save As the ValidPhoneNumber Edit Validate to a custom ruleset.
- Use the below code.
// All valid phone numbers would contain the numeric digits and - sign
for (int pos = 0, len = theValue.length(); pos < len; ++pos) {
if (! Character.isDigit(theValue.charAt(pos))
&& theValue.charAt(pos) != '-'&& theValue.charAt(pos) != 'x'&& theValue.charAt(pos) != 'X') {
if (!theValue.equals("n/a")){
return false;
}
}
}
return true;
Published April 1, 2020 - Updated December 2, 2021
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.