Whenever the Account is created with Industry as Banking then create a contact for account, Contact Lastname as Account name and contact phone as account phone.

2.8K    Asked by AmeliaArnold in Salesforce , Asked on Jan 5, 2020
Answered by Amelia Arnold

trigger account after handler on Account (before insert) {

list contacts = new list();

for(account acc : trigger.new){

if(acc.Industry == ‘Banking’){

contact con = new contact();

con.LastName = acc.name;

con.Phone = acc.Phone;

con.AccountId = acc.Id;

contacts.add(con);

}

}insert contacts;

}



Your Answer

Interviews

Parent Categories