Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

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

Prasad Dhumal
Mega Sage

Hi Priya, could you please try below regex:

^[a-zA-Z0-9._%+-]+@gmail\.com$