Email validation on Multi-row variable sets

DB1
Tera Contributor

Hi All,

 

I am looking for solution help with the below requirement.

 

1. I have a multi-row variable set with variables : "Name", "Title", "Phone", "Email" etc.

2. I want to have the validation on "Email".

Detail: If the User enters an email address it has to check the "sys_user" database to see if it returns any entry from the User record. If yes, it has to throw an error "User found!"

Can we do the validation on each row of the Multi- row variable when "Add" is selected every time?

 

DB1_0-1696851310887.png

 

 

I need help to build a solution for the above requirement.

 

TIA,

DB

 

@Peter Bodelier @Ankur Bawiskar  @AnveshKumar M 

 

 

 

 

11 REPLIES 11

DB1_0-1697115318668.png

 

Community Alums
Not applicable

Hello @DB1 ,

 

Update your script as:

var ABC_checkUserEmail = Class.create();
ABC_checkUserEmail.prototype = Object.extendsObject(AbstractAjaxProcessor, {

checkUserEmail: function() {
var emailaddress = this.getParameter('sysparm_email');
var gr = new GlideRecord("sys_user");
gr.addQuery("email", emailaddress);
gr.query();
if (gr.next()) {
return true;
}else{
return false;
}
},

type: 'ABC_checkUserEmail'
});

 

Thanks

Anand