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
Rahul kumar sfdcRahul kumar sfdc 

How to Write a trigger that automatically create a contact when account is created

How to Write a trigger that automatically create a contact when account is created?
IamSRNIamSRN
To create a Contact record, you need to capture the last name somewhere when a new account is added. After that you can write an after insert trigger to create Contact for each of the new Account created. Let me know if you need more info. 
nitin sharma 397nitin sharma 397
You can easily do this through process builder in 2  minutes so no need to write trigger for this 


For example in PB.
.In the criteria node specify Account.Active=true then choose create record action  and select contact and put the lastname in the lastname field and assign accountid=Id from the account object whch is related to contact and your will all set to go.