Create a child record when a new parent is created:
trigger newChild on Parent__c(after insert) {
List<Child__c> Childs = new List<Child__c>();
for(Parent__c a : trigger.new){
Child__c Child = new Child__c ();
Child.Parent__c = a.id;
Child.Name = 'Name1';
Childs.add(Child);
}
insert Childs;
}
Comments
Post a Comment