Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Email address should end with '@gmail.com' only.

2022_ServiceNow
Tera Expert

Hi,

 

I have a requirement in the catalog form. The user is asked to mention the required email address. The variable type given here is 'Single Line Text'. So, I want the user to give the email address which ends with '@gmail.com' only and if that name is already taken, then it should say 'this email address is not available'.

How can I achieve this?

 

Thanks, in advance.

2 ACCEPTED SOLUTIONS

Community Alums
Not applicable

@2022_ServiceNow you can use catalog client script here on submit, 

var email_= g_form.getValue('variable name').split('@'):

If (email_[1]=='gmail.com){

g_form.addErrorMessage('your error message to display to user on form');

return false;

}

 

Hope this will help you.

View solution in original post

Hello @2022_ServiceNow 

Please refer to the below community posts.

You will get multiple client scripts that can be used to validate the email pattern string:

View solution in original post

5 REPLIES 5

SatyakiBose
Mega Sage

Hello @2022_ServiceNow 

Where are you going to check if the email id has been already taken?

Validating a single line text ending with @gmail.com should be pretty simple. But how will you check if that email id is available or not?

Hi,

I tried validating it using '^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@gmail.com.com' but not able to attach it in the variable. There's no option available of validation regex. 

'@gmail.com' is an example. How about pointing it to the email address table and check whether it's available or not?

Hello @2022_ServiceNow 

Please refer to the below community posts.

You will get multiple client scripts that can be used to validate the email pattern string:

Community Alums
Not applicable

@2022_ServiceNow you can use catalog client script here on submit, 

var email_= g_form.getValue('variable name').split('@'):

If (email_[1]=='gmail.com){

g_form.addErrorMessage('your error message to display to user on form');

return false;

}

 

Hope this will help you.