Populate Rating as Hot for Media Accounts

When an Account is created and its Industry is set to “Media,” this trigger automatically sets the Rating to “Hot,” enforcing specific business logic for such accounts.

Learn more through this YouTube playlist.

Solution:
trigger AccountTrigger on Account (before insert) {
           if(Trigger.isInsert){ if(Trigger.isBefore){
                       AccountTriggerHandler.updateRating(Trigger.New);
             }
      }
}
         public class AccountTriggerHandler {
               public static void updateRating(List<Account> accList){ for(Account acc:accList){
                          if(acc.Industry!=null && acc.Industry==’Media’){ acc.Rating=’Hot’;
                }
           }
    }
}

Want to Apply As Content Writer?

Leave a Comment

Your email address will not be published. Required fields are marked *

Shopping Cart

Let's get you started!

Interested in writing Salesforce Content?

Fill in this form and we will get in touch with you :)