- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2024 11:52 PM
Contact number field should be in form of Country Code + Contact number and should not accept any other values than contact numbers.
can anyone give me scripts or business rules to enforce the mandatory requirement on both the client and server sides.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2024 12:02 AM
- Create the following onChange client script:
- Type: onChange
- Variable name: the name of the variable to be used
- Script:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
var pattern = /^[(]?(\d{3})[)]?[-|\s]?(\d{3})[-|\s]?(\d{4})$/;
if (!pattern.test(newValue)) {
g_form.setValue('variable_name', '');
g_form.showFieldMsg('variable_name','error message to display',true);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2024 11:57 PM
Hi Hema,
Could you please go through the following link.
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0719284
Thanks!
Ram
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2024 12:02 AM
- Create the following onChange client script:
- Type: onChange
- Variable name: the name of the variable to be used
- Script:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
var pattern = /^[(]?(\d{3})[)]?[-|\s]?(\d{3})[-|\s]?(\d{4})$/;
if (!pattern.test(newValue)) {
g_form.setValue('variable_name', '');
g_form.showFieldMsg('variable_name','error message to display',true);
}
}