function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MissaTXREGNMissaTXREGN 

Help with Multi Layer List

I have a page and class that I have written the end user will select an account.  Which creates a Parent Interaction on the Interaction Object.  From there, the end user can creat multiple interaction activities associated to the Parent Interaction.  I need to associate Interaction Participants (many) to the Interaction Activity and then save the participants (on object Interaction_Participants).  Different Particpants can be selected per each Interaction Activity.  The Participants need to be selected from the Contacts associated to the Account that was selected at the beginning. However, I am struggling with this last piece.  Below is my class.  I have stripped everything associated to Interaction_Participants out as it is erroring no matter what I try.  Any help isappreciated.  I'm running up a deadline and this is driving me nuts. 

 

public class InteractionsController {

/*------------------------
Private Variables 
------------------------*/


private Map<String, List<Interaction_Activity__c>> IAMap = new Map<String, List<Interaction_Activity__c>>();
private List<Interaction_Activity__c> pInt = new List<Interaction_Activity__c>();
private List<Interaction_Participant__c> IP = new List<Interaction_Participant__c>();
private String retUrl;

public Interaction__c InteractionRequest {get; set;}

integer cnt = 0;





/*------------------------
Consructor 
------------------------*/

public InteractionsController() {

ID accountId = ApexPages.currentPage().getParameters().get('accountId');


InteractionUtil IntU = new InteractionUtil();
InteractionRequest = IntU.queryInteraction(accountId);


   



        
InteractionRequest = new Interaction__c(Account__c =accountId);

if (accountId != null)
retUrl = '/' + accountId;
       




}



public List<Interaction_Activity__c> IA {
get {
return pInt;
}
private set;
}


/*------------------------
Private Methods 
------------------------*/




public PageReference Ints() {
return Page.Interactions;
}

public PageReference addCreate() {



 insert pInt;
 cnt = cnt + 1;
 
  
return null;


}


public PageReference addActivity() {

 if(cnt == 0) {
 insert InteractionRequest;
 pInt.add(new Interaction_Activity__c(Interaction__c=InteractionRequest.id));
 insert pInt; 
 cnt = cnt + 1;
 
 return null;
 }
 
 else
 
 { upsert InteractionRequest;
 pInt.add(new Interaction_Activity__c(Interaction__c=InteractionRequest.id));
  upsert pInt; 
 
  
return null;


}
}


public PageReference submit() {




upsert pInt;


return null;
}



public void addrowIA() {
pInt.add(new Interaction_Activity__c(Interaction__c=InteractionRequest.id));
} 



}