• Eshwar Ajay Sai Siddani
  • NEWBIE
  • 0 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
/* Write a trigger that automatically creates an Account whenever a Lead is created. The Account be named after the last name of the Lead*/


trigger Accountcreate on Lead(after insert){
 
   for(Lead ld:Trigger.new){

         Account acc= new Account();
 
         acc.Name=ld.Lastname;
     
           insert acc;

}

}


@isTest
private class AccountcreateTest {
    

    @isTest static void Accountcreate() {
        // Implement test code
    
           Lead ld = new Lead();
             
      ld.LastName ='Creed';
                
      ld.FirstName='Apollo';
            
      ld.Company  ='Rocky';
           
         Insert ld;

}
}