Restrict the use of particular mail id in a field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2025 10:56 PM
HI Community,
I have a requirement, in incident form we have a field called additional assignee list which is list type and reference to user table.
In this field i want to restrict the use of particular mail id let say xx@gmail.com users should not able to enter this particular mail id in that field
How can we achieve this?
Note: we don't have any users profile with this mail id but we can able to enter it using highlighted box (add email address)
Thanks in Advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2025 11:39 PM
Please use additional assignee field instead of watchlist, I used it on watchlist field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2025 01:13 AM
you can use onChange client script and see if that email is present, if yes then show error message to that field.
something like this
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
g_form.hideFieldMsg('fieldName');
if (newValue.indexOf('xx@gmail.com') > -1) {
g_form.showFieldMsg('field', 'The email address is not allowed', 'error');
}
//Type appropriate comment here, and begin script below
}
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
06-19-2025 09:27 PM
Hope you are doing good.
Did my reply answer your question?
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
06-25-2025 02:09 AM
Hope you are doing good.
Did my reply answer your question?
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
06-19-2025 01:21 AM
Hi @suuriyas ,
use this script
you can extend this with list of emails added to the array
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var restrictedEmails = ['xx@gmail.com']; //extend this array if required with lower case emils
restrictedEmails = restrictedEmails.map(function(em) {
return em.trim().toLowerCase();
})
var addRestrictedEmails = [];
newValue.split(',').forEach(function(i) {
if (restrictedEmails.includes(i.trim().toLowerCase())) {
addRestrictedEmails.push(i);
g_form.setValue('additional_assignee_list', newValue.replace(i, ''));
}
});
if (addRestrictedEmails.length)
g_form.showFieldMsg('additional_assignee_list', addRestrictedEmails.join() + ' should not be added', 'error');
}
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya