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
labh dhawan 8labh dhawan 8 

i need some examples on Apex trigger which can be related to any standard objects..please help..urgent need

Sergey TrusovSergey Trusov
trigger OpportunityTrigger on Opportunity (before update) {

    if (Trigger.isBefore && Trigger.isUpdate) {
          OpportunityTriggerHandler.handleBeforeUpdate(Trigger.oldMap, Trigger.newMap);
    }
    
}
What do you want to implement?
Swayam  AroraSwayam Arora
This is a very high level requirement. Please specify the details. But still giving you a simple example on before insert and update Account.

trigger MyAccountTrigger on Account(before insert, before update) {
        MyAccountTriggerHandler.setAccountRating(Trigger.New)
}

public class with sharing MyAccountTriggerHandler {
        public static void setAccountRating(List<Account> newAccounts) {
                for(Account acc : newAccounts) {
                        acc.Rating = 'Hot';
                }
        }
}