Whenever Account is Created automatically Contact should be Created using triggers

By | November 1, 2019

Trigger

trigger AccountInsertThenAutomaticInsertContact on Account (before insert) {
   list<contact> cont=new list<contact>();
   for(Account acc:trigger.new)
   {
       contact con=new contact();
       con.LastName=acc.Name;
       cont.add(con);
   }
   insert cont;
}
Share this...
Share on Facebook
Facebook
Email this to someone
email

Leave a Reply

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