So when you consider the following two else if statements. First Statement should have triggered as the conditions met; which is lead Source was 'PPL' and Campaign Name did not contain in the set(Campname), my second else if is the last else if I have within the IF statement which is executing even though my first else if is True. Am I using wrong syntax for does not contain ?

else if((l.LeadSource=='PPC' || l.LeadSource=='PPL') && !            (Campname.contains(l.Campaign_Name__c))) //CampName is a set

else if()
    l.No_match_for_immediate_response__c= true;
  • why do you have a blank else if(), why not just have else { l.No_match_for_immediate_response__c= true;} – Rao Jul 14 '15 at 19:31
  • There is a containsIgnoreCase that you might use if the case is inconsistent or you don't care about it in your logic. – Keith C Jul 14 '15 at 19:31
  • 1
    Is it possible to provide the debug log? I would be interested to know what the values are in the Campname set and what l.Campaign_Name__c equals. – techbusinessman Jul 14 '15 at 19:34
  • @Rao: I actually removed the logic; since its irrelevant to this. – Sanjay Jul 14 '15 at 19:53
  • 1
    Debug logs for the win! – techbusinessman Jul 15 '15 at 14:40

Well thanks to the Debug !

Campaign Name is getting updated by a team where there is a delay at times and my scheduler class is calling the logic before any Name is provided to Campaign, so at that point the debug returns Campaign Name as 'Null'.

So I included null in the set I'm checking the values from and it worked !!

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.