I have a wrapper class which has one attribute for Parent record and another list of child records.
I'm getting this list of wrappers from my lightning component. Now I need to insert these records.
How can I map the parent with the correct child record while inserting?
Wrapper:
public class Wrapper {
@AuraEnabled
public Account acc {get;set;}
@AuraEnabled
public List<Contact> conList{get;set;}
public TaskAnalysisDataWrapper(){
acc = new Account();
conList = new List<Contact>();
}
}
Now I have a list of Wrapper in my apex method:
List<Wrapper> wrapperList
How can I match contact with correct account while inserting records?