I just started using SSJS and the syntax is a bit new.
I need to check if a subsriber exists in a data extension, based on email address.
if (IsEmailAddress(submitterEmail)){
var requestsDE = DataExtension.Init('dataextensionname');
var exists = requestsDE.Rows.Lookup(["email"], [submitterEmail]);
var rows = rowCount(exists);
if rows < 1 {
alert('less than one row')
}
else do stuff
So I want to check if the email address 'submitterEmail' at all exists in the data extension (column 'email'), and then I want to count if there are any rows. If there is I eventlually want to update the row, else I want to add a row.
Anyone who please can give me a hint or a code snippet on how to do this? (my code doesn't work and I think there is something wrong in the countRow or Lookup area)