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
Nagarjun TNagarjun T 

trigger to create contact record from account object

I Need to create contact record automatically when account record is created 
Best Answer chosen by Nagarjun T
Nagarjun TNagarjun T
Trigger accountinsertautomaticallycontactalsoinsert on Account(After Insert,after update)
{
    List<Contact> conlst = new List<Contact>();
    For(Account acc:Trigger.New){
       Contact con = New Contact();
       con.lastname = acc.name;
       con.phone = acc.phone;
       con.accountid=acc.id;
       conlst.add(con);
    }
    insert conlst;