For each row in SubForm create a CRM record - zoho.crm.create

For each row in SubForm create a CRM record - zoho.crm.create

We're trying to create a new 'CRM' PurchaseOrders record for each row in a 'Creator' SubForm.

I have written the below code, this currently creates CRM records "On Success" but instead of pushing each rows unique data into a new CRM record, it pushes duplicate data from row 1 into each record  

e.g. if there are four rows in the sub form, it creates 4 records in the CRM but all have data from row 1.

What we would like it to do is create a unique CRM record for each row in the SubForm 

e.g. row 1 data creates record 1, row 2 data creates record 2, row 3 data creates record 3 etc

Our current code

  1. for each row in Reservations
  2. {
  3. //map product 
  4. roomMap = map();
  5. roomMap.put("Product Name", "Double room");
  6. roomMap.put("Quantity", 2);
  7. roomMap.put("Unit Price", 80);
  8. roomMap.put("List Price", 90);

  9. //map PurchaseOrder Values
  10. resMap = map();
  11. resMap.put("Subject", Reservations.Night);
  12. resMap.put("Vendor Name", Reservations.Zoho_CRM);
  13. resMap.put("Reservation Date", Reservations.Date_field);
  14. resMap.put("Product", roomMap);

  15. //create record in CRM with map values
  16. resSend = zoho.crm.create("PurchaseOrders", resMap);
  17. }


Any advice is greatly appreciated