• Matt Lim 7
  • NEWBIE
  • 10 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
I am trying to create two identical contacts upon account creation. so far i have written below :
trigger IdenticalContacts on Account (after insert) {
    for (Account acc : Trigger.new){
    
        Contact con = new Contact();
        con.LastName = 'Monkey D';
        con.FirstName = 'Luffy';
        con.email = 'goldroger@gmail.com';
        con.AccountId = acc.id;
            
     }                           
}
I also wrote test class below but getting 0% code coverage:
@isTest
public class TestIndenticalContacts {
    
    @isTest static void createAccount(){
        Account acc = new Account();
        acc.Name = 'Salesforce';
        insert acc;
    }
}
Is the problem due to 'After Insert'?