function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
trigger accountcontat on Account (before update){ list<Contact> lstCon = new list<Contact>(); for(Account Acc :trigger.new){ if(Acc.Name != Trigger.oldMap.get(Acc.Id).Name){ Contact Con = new Contact(); Con.FirstName = Acc.Name; Con.LastName ='Contact'; Con.AccountId = Acc.Id; lstCon.add(Con); } } if(lstCon.size()>0){ Insert lstCon; } }
trigger CreateContact on Account (after update){ if(Trigger.isupdate){ List<Contact> ct = new List <Contact>(); for(Account acc : trigger.new){ if(Acc.Name != Trigger.oldMap.get(Acc.Id).Name){ Contact c = new Contact(LastName = acc.name, AccountId=acc.id, Fax=acc.Fax, MailingStreet=acc.BillingStreet, MailingCity=acc.BillingCity, MailingState=acc.BillingState, MailingPostalCode=acc.BillingPostalCode, MailingCountry=acc.BillingCountry, Phone=acc.Phone); ct.add(c); } if(!ct.isEmpty()) insert ct; } } }
trigger CreateContat on Account (After update){ if(trigger.isAfter && trigger.isUpdate){ list<Contact> lstCon = new list<Contact>(); for(Account Acc :trigger.new){ if(Acc.Name != Trigger.oldMap.get(Acc.Id).Name){ Contact Con = new Contact(); Con.FirstName = Acc.Name; Con.LastName ='Contact'; Con.AccountId = Acc.Id; lstCon.add(Con); } } if(lstCon.size()>0){ Insert lstCon; } } }
Hi,
Please find the solution.
trigger CreateContact on Account (before update){ List<Contact> contactList = new List<Contact>(); for(Account ac :trigger.new){ if(ac.Name != Trigger.oldMap.get(ac.Id).Name){ Contact Con = new Contact(); Con.FirstName = 'Default'; Con.LastName ='Contact'; Con.AccountId = ac.Id; contactList.add(Con); } } if(contactList.size()>0){ Insert contactList; } }
Thank you
Try Below trigger Please Mark It As Best Answer If It Helps
Thank You!
All Answers
Try Below trigger Please Mark It As Best Answer If It Helps
Thank You!
Please use below code:-
if you need any assistanse, Please let me know!!
Kindly mark my solution as the best answer if it helps you.
Thanks
Mukesh
find your solution by using below trigger.
let me know if it helps you and don't forget to mark it as best answer.
Thank you
Hi,
Please find the solution.
Thank you