0
list<dnc_suppression__c> dncsup = new list<dnc_suppression__c>();    
dncsup = [
    select
        id, vin__c, DNC_Owner_Ind__c, First_Name__c, Email_Ind__c,
        Campaign_ID_1__c, Campaign_ID_2__c, Campaign_ID_3__c, Campaign_ID_4__c,
        Campaign_ID_5__c, Campaign_ID_6__c, Email_1__c, Email_2__c, Home_Phone__c,
        Phone_Auto_Dialer_Ind__c,Text_SMS_Ind__c, mobile__c, Campaign_Reminders_Ind__c,
        DNC_Vehicle_Ind__c
    from dnc_suppression__c
    where vin__c IN: aset && Campaign_Reminders_Ind__c = true
    OR DNC_Owner_Ind__c = true 
    OR DNC_Vehicle_Ind__c = true
    ];

showing "Expression cannot be assigned" for this line

  • What is aset? Have you checked that it has a value before you execute the select? – David Cheng Apr 16 at 22:58
  • I see you have && in there, most likely for an and condition, does that compile? I haven’t tried it out myself anytime. – Jayant Das Apr 16 at 23:17
4

Your problem seems to be your use of && rather than AND:

Incorrect:

where vin__c IN: aset && Campaign_Reminders_Ind__c = true
OR DNC_Owner_Ind__c = true 
OR DNC_Vehicle_Ind__c = true

Correct:

where vin__c IN: aset AND Campaign_Reminders_Ind__c = true
OR DNC_Owner_Ind__c = true 
OR DNC_Vehicle_Ind__c = true

However, you also need to use parentheses to indicate to the parser if it's A AND (B OR C OR D) or (A AND B) OR C OR D or some other permutation.

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.