We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

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

Not applicable

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.