function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ 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 "=="