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

I need Trigger Example

Once i have created record in account object and automatically created releted list contact  record created how to achive this 


Hi suresh,


Below is the sample trigger for your requirement.


Apex Trigger:

trigger trgCreateContact on Account (after insert) {
	List<Contact> lstCon = new List<Contact>();
        Contact objCon=new Contact();
        objCon.LastName = 'value which you give';
		objCon.Accountid =;
	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.

Thank You,
Hitesh Patel
SFDC Certified Developer & Administrator & Advanced Administrator & Sales cloud consultant
My Blog:-