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

On creation of a particular record I want 3 records to be created automatically.

I have two Objects.
when a record is created in Object1 and hold the status field picklist value as Started then, I want to create 3 records in Object2 . How can I achieve this?
AnudeepAnudeep (Salesforce Developers) 
Hi Nyshaa, 

I am unsure if you can achieve this through process builder, but if you are going with trigger, you can try something like this (This is just a sample please make changes to the code as required)
trigger CreateAccountContact on Account (after insert, after update){


    List<Contact> ct = new List <Contact>();

    for(Account acc :{
       if(acc.Status=='Started') {

        for(Integer i=0; i<3; i++) {

        Contact c = new Contact(LastName = 'Test'+''+i,
                    /* similarly add all fields which you want */


    insert ct; 

Caleb Kuester 27Caleb Kuester 27
I would use a process builder. If you know code, it's great to be able to flex your muscle, but any excuse to not have to write a test class, or expose your client to increased code maintainance cost is a good excuse.

That being said, they have their limitations. We don't know how object1 is related to object2, so that might potentially not be an option.