trigger trgCreateContact on Account (after insert) {
List<Contact> lstCon = new List<Contact>();
for(account a:trigger.new){
Contact objCon=new Contact();
objCon.LastName = 'value which you give';
objCon.Accountid = a.id;
lstCon.add(objCon);
}
if(lstCon.size() > 0){
insert lstCon;
}
}
Important : Hit Kudos if this provides you with useful information and if this is what you where looking for then please mark it as a solution for other benefits.
Hi suresh,
Below is the sample trigger for your requirement.
Apex Trigger:
Important :
Hit Kudos if this provides you with useful information and if this is what you where looking for then please mark it as a solution for other benefits.
Thank You,
Hitesh Patel
SFDC Certified Developer & Administrator & Advanced Administrator & Sales cloud consultant
My Blog:- http://mrjavascript.blogspot.in/