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
- for each row in Reservations
- {
- //map product
- roomMap = map();
- roomMap.put("Product Name", "Double room");
- roomMap.put("Quantity", 2);
- roomMap.put("Unit Price", 80);
- roomMap.put("List Price", 90);
- //map PurchaseOrder Values
- resMap = map();
- resMap.put("Subject", Reservations.Night);
- resMap.put("Vendor Name", Reservations.Zoho_CRM);
- resMap.put("Reservation Date", Reservations.Date_field);
- resMap.put("Product", roomMap);
- //create record in CRM with map values
- resSend = zoho.crm.create("PurchaseOrders", resMap);
- }
Any advice is greatly appreciated