Here’s a cool bite-sized function for you! We’re gonna show you how to add subform rows on Zoho CRM via Deluge scripting without overwriting existing row(s), no API calls needed!
If you’ve ever Googled this, you would probably find the API documentation on subforms. While this works, it doesn’t explain the parameters needed if you’d like to add additional rows without overwriting the table. Plus, if you’re gonna be executing this function in CRM, the method I’m about to show you is simpler.
If this is helpful, check out our other Zoho training and educational resources! And, for more information about CRM, take a look at our HubSpot and Zoho CRM comparison.
updateMap = Map();
updateMap.put("Product","Apples");
updateMap.put("Quantity","50");
updateMap.put("Price","2");
updateList = List();
updateList.add(updateMap);
This step will prevent the existing subform row(s) from being overwritten.
record = zoho.crm.getRecordById("INSERT_MODULE_API_NAME", "INSERT_RECORD_ID");
subform = record.get("INSERT_SUBFORM_API_NAME");
for each s in subform
{
updateList.add({"id":s.get("id")});
}
Update the subform on the CRM record with the updateList variable that you have made.
updateCRM = zoho.crm.updateRecord("INSERT_MODULE_API_NAME", "INSERT_RECORD_ID" , {"INSERT_SUBFORM_API_NAME" : updateList});
info updateCRM;
Book a free 30-minutes consultation with a Zoho expert or send us an email