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
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.  

Thanks.