- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2018 10:49 AM
The user should not be able to submit the form if the email is in incorrect format and prompted to correct it.
PS: I am using the username field above to auto-populate the user's email using catalog client script. Please help! Thanks.
Solved! Go to Solution.
- Labels:
-
Facilities Service Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2018 11:07 AM
Hey omkar,
why don't you create Email type variable
The email variable creates a widget for users to enter and select an email address. It accepts only valid email expressions containing @ and domain information.
Example of an email variable
Refer:
Thanks,
Rajashekhar Mushke
Rising star : 2022 - 2024
Community Leader -2018
Connect me on LinkedIn : Rajashekhar Mushke

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2018 10:56 AM
I would recommend automatically populating the email address when a name is added on the "Contact Person" field.
If the value is bad or empty add an onChange script on "Please enter the E-mail address"and use an email regex pattern. If they give the wrong pattern, clear the value and show an error message.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2018 11:05 AM
Thanks Darla. But you could you please help me write a script since I'm fairly new to scripting and SNOW development.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2018 11:13 AM
If you have Kingston, use the other suggestion. If not, then the script below should work with minor tweaks:
UI Type: All
Type: onChange
function onChange(control, oldValue, newValue, isLoading) {
g_form.hideErrorBox('recipient_email');
if (isLoading || newValue == '') {
return;
}
//Validate the value in the email field is valid
var valid = validateEmail(newValue);
if (!valid)
g_form.showErrorBox('recipient_email', getMessage('Invalid email address'));
else
g_form.hideErrorBox('recipient_email');
}
function validateEmail(email) {
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(email);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2018 12:38 PM
Thank you so much, it worked but it still allows me to submit the request with bad email. Please let me know how to avoid that?