Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

Trying to prevent duplicate users with same email address in my custom user table

Thomas Miles
Tera Contributor

I am writing a client script to stop a user from creating a new user record if the same address is in the system already

 

function onSubmit() {
    //Type appropriate comment here, and begin script below
    var currentEmail = g_form.getValue('email');
    
    var newUser = new GlideRecord('table_name');
    newUser.addQuery('email', currentEmail);
    newUser.query();
    if (newUser.next()) { 
        return false;
        
    }
}

5 REPLIES 5

yeah , you can still use this feature, it doesn't matter the scope of the app. 

Add unique field in the global for the table Dictionnary Entry [sys_dictionary] and after that switch to your scope to check the field Unique.