Email validation on Multi-row variable sets
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2023 04:37 AM
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?
I need help to build a solution for the above requirement.
TIA,
DB
@Peter Bodelier @Ankur Bawiskar @AnveshKumar M
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2023 05:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2023 06:11 AM
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