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
adi salesforceadi salesforce 

Trigger to populate contact description in account description.

Brahmaiah GantaBrahmaiah Ganta
Trigger TriggerName on Contact(After insert,After Update){
 List<Account> accList = new List<Account>();
  for (Contact con : Trigger.new){
       acc = [select id,Name,description from Account where id := con.Accountid];
      acc.description = con.description;
       accList.add(acc);
   }
 updae accList;
}
Narender Singh(Nads)Narender Singh(Nads)
Hi,
Use the following code:
Trigger UpdateAccounts on Contact(After insert,After Update){
 List<Account> accList = new List<Account>();
  for (Contact con : Trigger.new){
       account acc=new account();
      acc.id=con.accountId;
      acc.description = con.description;
       accList.add(acc);
   }
  if(accList.size()>0){
   updae accList;
  }  
}
Thanks!