Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Trigger accCreation on Contact (After Insert){
- switch on Trigger.operationType{
- when BEFORE_INSERT{
- accCreationHelper.createContact(Trigger.new);
- }
- }
- }
- Public with sharing accCreationHelper{
- public static void createContact(List<Account> accList){
- if(accList != null){
- List<Contact> conUpdate = new List<contact>();
- for(Account a : accList){
- List<contact> conList = new List<contact>();
- for (Integer i = 0 ; i == accList.size() ; i++){
- contact con = new contact();
- con.Id = a.Id;
- con.name = a.name+'i';
- conUpdate.add(con);
- }
- }
- Insert conUpdate;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement