Inserting Sub-Form Rows

Inserting Sub-Form Rows

Hi everyone, 

I've done some reading around and whilst the problems seems to be solvable I'm going around in circles

Scenario
Once new inventory component is created, we need to pre-populate a list of tasks for (percentage) allocation. (via Custom Function) 

Problem
I can't seem to be able to loop through the tasks and incrementally add them into the sub-form.  I have tried  Directly adding (via insert record) to Sub-Form.  However, I get the error " Form 'Task_Distribution' does not exist in the application"  




  1. void Estimator.CreateInventoryTaskTemplate (int factorID)
  2. {
  3. // TEST RECORD
  4. // 3724905000000045031

  5. // Retrieve the current tasks associated to TEST 
  6. tasks = Task [ Work_Stream.Name="TEST" && State = "Active"];
  7.  
  8. // Retrieve the current factor
  9. for each factor in Factor [ ID = factorID ]
  10.     {
  11. // Populate the initial tasks available to applications
  12. for each task in tasks
  13. {
  14.         // THIS IS WHERE WE NEED TO POPULATE THE ALLOCATED TASKS
  15.                         // INFORMATION THAT NEEDS TO BE POPULATED
  16.                         // factor.Task_Distribution (sub-Form)
  17.                         // factor.Task_Distribution.Factor (Parent Record) 
  18.                         // factor.Task_Distribution.Task (LookUp)
  19.                         // factor.Task_Distribution. Allocation (Percentage %)
  20. }
  21.     } 

  22. }