You need to sign in to do that
Don't have an account?
After Insert Trigger to create child record
Contacts have a lookup relationship to a custom Worker__c object.
Whenever a new Worker__c record is created, I want to create an associated (child) Contact.
My code is as follows:
But I get an error in between the second and third lines. Can anyone help?
Thank you.
Whenever a new Worker__c record is created, I want to create an associated (child) Contact.
My code is as follows:
trigger NewContactforWorker on Worker__c (after insert) { List<Contact> conList = new List<Contact>; for (Worker__c wkr : trigger.new) { a = new Contact(Worker__c = wkr.Id, FirstName = wkr.First_Name__c, LastName = wkr.Last_Name__c, QSAC_external_id__c = wkr.Worker_External_ID__c); conList.add(a); } insert conList; }
But I get an error in between the second and third lines. Can anyone help?
Thank you.
Please change your code to the code below
All Answers
List<Contact> conList=new Lits<Contact>();
Please change your code to the code below