I have a function that have 2 List of Objects in parameters (Schedule__c recList and scheduleTable__c recList2). Once I insert the recList, I am looping through the ID and insert child records to it. To do so, I am doing two loops. Here it is.
@AuraEnabled
public static void saveRecord(List<Schedule__c> recList, List<scheduleTable__c> recList2){
insert recList;
for(Schedule__c a : recList){
String newId = a.Id;
for(scheduleTable__c s : recList2){
s.Schedule__c.add(newId);
insert s;
}
}
}
I have an error saying Method does not exist or incorrect signature: void add(String) from the type Id. Not too sure what that means... Any idea how I can insert the child record under the Parent record? Thanks