+ Start a Discussion
Shruthi MN 71Shruthi MN 71 

Apex Trigger 'Expression cannot be a statement.'

Please correct the below code

trigger AccountTrigger on Account (after update ,after insert) {
    for(Account a: Trigger.new){
        if(a.industry== 'Energy'){
            a.Rating =='Hot';

I am getting below error

User-added image
ANUTEJANUTEJ (Salesforce Developers) 
Hi Shruthi,

Change the above line a.Rating =='Hot'; to a.Rating ='Hot'; and it should work.

Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.