- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-22-2025 08:44 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2025 05:13 AM
then use this
// onChange Client Script for mobile_number field
// Type: onChange
// Field name: mobile_number
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue == '') {
return;
}
// Remove all spaces for validation
var value = newValue.replace(/\s/g, '');
// Regex: Must start with '+', followed by exactly 10 digits, nothing else
var regex = /^\+\d{10}$/;
if (!regex.test(value)) {
g_form.showFieldMsg(
'mobile_number',
'Please enter a valid mobile number: must start with "+" and be followed by exactly 10 digits.',
'error'
);
g_form.clearValue('mobile_number');
} else {
g_form.hideFieldMsg('mobile_number');
}
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-22-2025 09:34 AM
Hi @Ria
You can utilize onchange Client script on mobile number field to validate if entered value matches 10 digits including only one "+" sign.
What will be accepted (valid examples):
Input Reason
+1234567890 | Exactly + followed by 10 digits |
+0987654321 | Exactly + followed by 10 digits |
What will NOT be accepted (invalid examples):
Input Reason
1234567890 | Missing the required + at start |
+123456789 | Only 9 digits (too short) |
+12345678901 | 11 digits (too long) |
+12345abcde | Contains letters, not digits |
++1234567890 | Two plus signs, invalid |
+1234567890 | Leading space before + |
+1234567890 | Trailing space after digits |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2025 06:54 AM
Could you please let me know why changes are not reflecting on portal but changes are reflecting on backend?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2025 05:58 PM
@Ria please select UI Type to all so your client script should be able to run on portal as well.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2025 03:55 AM - edited ‎05-26-2025 03:56 AM
Hi,
This regular expression will allow for an input of an optional + sign at the beginning, then 10 or more numbers.
^[+]?[\d]{10,}$
Will that work for you ?
And if you want to enforce the + sign in the beginning, just remove the question-mark from the expression.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2025 04:56 AM
Hi @OlaN
I’ve created a new regular expression, but even after entering the correct details, it still returns a null error. The error message should be cleared once valid input is provided.