How to I get checkboxes on a subform to update via deluge
Hello, would someone be able to tell me what I'm doing wrong here?
I am trying to take the contents of a Deals subform and add them to an invoice then update the checkbox on each row so that 'add to invoice' is unticked and 'invoiced' is ticked.
The output of "checkboxmp" seems to show all the info I am expecting, but possibly not in the right format because on the actual deal page, it just clears all the fields in the subform except for the checkboxes...but the even checkboxes are not updated.
- // subform items
- sitems_returned = order.get("Storage_Subform");
- if(sitems_returned != null && sitems_returned.size() > 0)
- {
- subform_Update = List();
- // gets the subform items one by one
- for each sitem in sitems_returned
- {
- itemtype = sitem.get(itemtype_field_api_name);
- sprice = sitem.get(storage_price_api_name);
- invoiced = sitem.get(invoiced_field_api_name);
- months = sitem.get(months_field_api_name);
if(!invoiced)
- {
- // Add each item to invoice map if not already invoiced
- sitemMap = Map();
- sitemMap.put("name",itemtype);
- sitemMap.put("description","Up to " + months + " months.");
- sitemMap.put("quantity",1);
- sitemMap.put("rate",sprice);
- sitemMap.put("tax_id",standardRateVatId);
- itemList.add(sitemMap);
- // checkbox update to show it has been invoiced now
- checkmp = Map();
- checkmp.put("Invoiced",true);
- checkmp.put("Add_to_Invoice",false);
- subform_Update.add(sitemMap);
- subform_Update.add(checkmp);
- checkboxmp = Map();
- checkboxmp.put("Storage_Subform",subform_Update);
- updateCheckbox = zoho.crm.updateRecord("Deals", orderId, checkboxmp);
- info checkboxmp;
- }
- }
In case it helps, this is the output of checkboxmp:
checkboxmp{"Storage_Subform":[{"name":{"name":"Storage - Additional","id":"622308000029387251"},"description":"Up to 12 months.","quantity":1,"rate":300,"tax_id":"150337000000181013"},{"Invoiced":true,"Add_to_Invoice":false}]}