+ Start a Discussion
jeazyjeazy 

Compile Error: AND operator can only be applied to Boolean expressions

Please help!! This is the if statement in a trigger:

 if((c.RecordTypeId == caseRTypeMap.get('Promotions') && c.S_Category__c != 'Draft Kit') || (c.RecordTypeId = caseRTypeMap.get('Fantasy') && c.S_Category__c == 'Referral, Trophy')){
            c.Queue__c = '(Fulfillment) Promotions';
        }

This is the error message I am getting:
“Error: Compile Error: AND operator can only be applied to Boolean expressions at line 400 column 191

Thanks in Advance,
Best Answer chosen by jeazy
James LoghryJames Loghry

You're missing an "=" here:

c.RecordTypeId = caseRTypeMap.get('Fantasy')

changing it to the following should work:
 
c.RecordTypeId == caseRTypeMap.get('Fantasy')

 

All Answers

James LoghryJames Loghry

You're missing an "=" here:

c.RecordTypeId = caseRTypeMap.get('Fantasy')

changing it to the following should work:
 
c.RecordTypeId == caseRTypeMap.get('Fantasy')

 
This was selected as the best answer
Vla ChaVla Cha
Hey jeazy,

I see c.RecordTypeId = caseRTypeMap.get('Fantasy') which is obviously not a boolean expression. Maybe you can try to replace "=" with "=="?

Cheers!
jeazyjeazy
Thanks James and Via!
I totally missed the "=="