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
pfeppfep 

help on this trigger

ErrorError: Compile Error: AND operator can only be applied to Boolean expressions at line 15 column 40

 

this is what it say all the time. how can it b fixed?


trigger PreventEngagementsFromDelete on Engagement__c(before Delete){


RecordType[] RT = [Select Name From RecordType Where sObjectType = 'engagement__c' and Name = 'Interest Form' and isActive = true LIMIT 1];


for(Engagement__c e : trigger.new){

   if(!rt.isEmpty()){

      if(e.RecordTypeID = RT[0].id && e.Status__c = 'Prospect')

           e.addError('You cannot delete this record');

    }else{

           e.addError('Contact System Admin, there was an error finding the correct RecordType for this validation');

    }

 

}

 

Best Answer chosen by Admin (Salesforce Developers) 
sanjaypatidarsanjaypatidar

Change the Line as below 

 

 if(e.RecordTypeID == RT[0].id && e.Status__c == 'Prospect')

 

Please mark as solved if this helps.