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.

enter image description here

2 Answers 2


When you have a != b || a != c where b != c, it will always be true. In this case, you always know this part of the clause will return true:

l.LeadSource != 'dup' || l.LeadSource != 'Package Installation'

It seems like you may just want to join all your clauses with && instead.


Because you are using OR conditions. || is OR. So you basically have

if( l.LeadSource NOT EQUAL TO 'Package Installation' OR l.Email NOT EQUAL TO null ) 

Even if l.Email is null l.LeadSource may not be Package Installation (Which is also a condition to execute).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.