The following code snippet, added to the Script that controls whether this trigger program is run field of a trigger program, prevents the trigger from sending to the person if @yourdomain1.com
is part of their email address.
var excluded_email_suffixs = ['@yourdomain1.com'];
result.proceed = true;
if (person && person.email) {
for (var i = 0; i < excluded_email_suffixs.length; i++) {
if (person.email.indexOf(excluded_email_suffixs[i]) > -1) {
result.proceed = false;
}
}
}
You can check for multiple domains within the person's email address by simply adding additional values on to the end of the excluded_email_suffixs array. For example:
var excluded_email_suffixs = ['@yourdomain1.com','@yourdomain2.com'];
result.proceed = true;
if (person && person.email) {
for (var i = 0; i < excluded_email_suffixs.length; i++) {
if (person.email.indexOf(excluded_email_suffixs[i]) > -1) {
result.proceed = false;
}
}
}