1 2 3 4 5 6 7 8 9 10 11 12 13 14 | trigger CreateContact on Account (after insert) {
List<contact> ConList = New List<Contact>();
for(Account Acc : Trigger.New){
Contact con = New Contact();
con.LastName = Acc.Name + ' Contact';
con.AccountId = Acc.Id;
ConList.add(con);
}
if(ConList.Size()>0 && !(ConList.isEmpty()))
insert ConList;
}
|
No comments:
Post a Comment