In my Apex Trigger
I have code that I want to execute when any of the conditions are met.
trigger NewLeadSendToInfusionsoft on Lead (before insert, before update) {
for (Lead l : Trigger.new) {
if(l.LeadSource != 'dup' || l.LeadSource != 'Package Installation' || l.Email != null || l.Status != 'At Infusionsoft') {
LeadInfusionsoft.sendNewLeadToInfusionsoft(l.FirstName, l.LastName, l.Title, l.Company,
l.Street, l.City, l.State, l.PostalCode,
l.Country, l.Phone, l.MobilePhone, l.Email, l.LeadSource);
}
}
}
The problem I have is it always executes, even though in the debug log it says the Email
field is null
.
Best Answer
When you have
a != b || a != c
whereb != c
, it will always be true. In this case, you always know this part of the clause will return true:It seems like you may just want to join all your clauses with
&&
instead.