You need to sign in to do that
Don't have an account?
Linda 98
help on else if statements with OR operator.
My question might be silly but i am missing something which i am not able to figure it out.
I am having various if,else if statments in my apex class.
which i had written like below.For some reason OR (||) operator is not functioning as expected.
please correct me what am i missing.
Thank you in advance!
I am having various if,else if statments in my apex class.
which i had written like below.For some reason OR (||) operator is not functioning as expected.
please correct me what am i missing.
if((opp.stagename =='aaa' || opp.stagename=='bbb') && (opp.Description == null || opp.Rate__c == null || opp.Due_Date__c == null)) { system.debug('ENTER IN TO IF'); } else if((opp.stagename=='ccc' || opp.Stagename =='ddd') && (Opp.Description ==null || opp.Rate__c ==null || opp.Due_Date__c ==null)){ system.debug('ENTER IN TO ELSEIF'); } else if(opp.stagename == 'eee' || opp.stagename =='fff' || opp.stagename=='ggg' || Opp.stagename == 'hhh' || Opp.StageName == 'Closed Lost' || opp.StageName == 'Closed Won'){ system.debug('ENTER IN TO 2nd ELSEIF') // THIS IS WHERE I AM FAILING.EVEN THE STATEMENTS IS FALSE,ITS ENTERING TO ELSE IF INSTEAD OF ELSE.rEST ALL WORKS FINE. } else{ // another logic here. }
Thank you in advance!
It has to go to else statements.
1. stagename
2. Description
3. Rate__c
4. Due_Date__c
that you are using for the testing?