Skip to main content
Hello All,

In was able to write code for Insert and update but, not able to find a way for the delete operation. Could you please assist ?

//Below is the code

trigger ABCTrigger on Contact (after insert,after update,after delete) 

{    

    List<Account> acclst = new List<Account>();

            for(Contact con : trigger.new) 

                {

                       if(con.Birthdate != null) 

                    {

                        Account acc = new Account();

                        acc.id = con.AccountId;

                        acc.Birth_Date__c = con.Birthdate;

                        acclst.add(acc);

                    }

                }

    update acclst;

    

     for(Contact con : trigger.new) 

                {

                       if(con.Birthdate != null) 

                    {

                        Account acc = new Account();

                        acc.id = con.AccountId;

                        acc.Birth_Date__c = con.Birthdate;

                        acclst.add(acc);

                    }

                }

}
1 respuesta
0/9000