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
Soujanya Uppal 9Soujanya Uppal 9 

i want to update the record on Account through soql if city= Hyderabad then rating = Hot, if city= Paris then rating =Cold, if city=Austin then rating=warm,if city equals to vizag then rating = Yahoo and for rest of records rating=Google

CharuDuttCharuDutt
Hii Soujanya
Try Below Trigger
trigger testtrigger on Account (Before Insert,Before Update){
	if(trigger.IsBefore ){ 
	If(trigger.IsInsert || trigger.IsUpdate){
	for(Account Acc : trigger.new){
	if(Acc.City__c == 'Hyderabad'){
			Acc.Rating = 'Hot';
	}else if(Acc.City__c == 'Paris'){
			Acc.Rating = 'Cold';
	}else if(Acc.City__c == 'Austn'){
			Acc.Rating = 'Warm';
	}else if(Acc.City__c == 'Vizag'){
			Acc.Rating = 'Yahoo';
	}else {
			Acc.Rating = 'Google';
				}
			}
		}
	}
}
Please Mark It As Best Answer If It Helps
Thank You!
AnkaiahAnkaiah (Salesforce Developers) 
Trigger RatingUpdate on Account (before insert, before update){

for (Account Acc: trigger.New){

      if(acc.city=='Hyderabad'){
    acc.Rating = 'Hot';
}else if(acc.city=='Paris'){
    acc.Rating = 'Clod';
}else if(acc.city=='Austin'){
    acc.Rating = 'Waqrm';
}else if(acc.city=='Vizag'){
    acc.Rating = 'Yahoo';
}
else{

acc.Rating = 'Google';
}

}

}

 
Soujanya Uppal 9Soujanya Uppal 9
Hi i want without trigger through soql