How to use deluge scripts to insert rows to subform

How to use deluge scripts to insert rows to subform

I have 2 forms, Box form with Seed_Packs entries that links to another Form Seed_Inventory entries. After I have use the import functions, the entries did not link from Seed_Inventory to Box.Seed_Packs, I want to use scripts to do the linking by creating a schedule flow to run it manually.

The following is my code:

//create a subform collection
subformCollection = Collection();

//define the rows to be inserted
row1 = Box.Seed_Packs(Box_ID = "GB_0003");

//get data from seed inventory
getBoxID = Box[Box_ID = "GB_0003"].ID;
getSeedInventory = Seed_Inventory[Box_ID_QR = getBoxID].Stock_ID.getAll().toList();

//looping entries from seed inventory and recursively insert the rows to Box.Seed_Packs
for each rec in getSeedInventory
{
row1.Seed_Inventory = rec;
subformCollection.insert(row1);

But I am stucked as when I execute the flow, i got the following error:

Invalid update task found corresponding properties Line:(7) which refer to "row1.Seed_Inventory = rec;"

Any help is highly appreciated.

Thank you!