As you can tell from all of my earlier questions I'm attempting to learn some NetSuite Suitescript to truly leverage NetSuite. With that being said I've got to where I can search for the max employee number and then act accordingly. Now what I want to do is to search for an email address to see if the one given is a duplicate. Essentially ensure the workflow will not create a new employee record if an employee record already exists with the email address.
I have the following so far...
function checkDuplicate(givenEmail){
var filters = new nlobjSearchFilter('email', null, givenEmail);
var colums = new nlobjSearchColumn('email');
var results = new nlobjSearchRecord('employee', null, filters, columns);
if(results[0].getValue('email') == null) return false;
else return true;
}
Is there a better/easier way? I'll be testing this out.