Function to bulk delete records in ZohoCRM
I have a couple of custom Modules and I'm currently bulk deleting related records like this:
CalendarEvents = zoho.crm.searchRecords("Calendar_Events","(Resource:equals:" + resourceCalendarId.toLong() + ")");
for each CalendarEvent in CalendarEvents
{
deleteRecordMap = Map();
deleteRecordMap.put("module","Calendar_Events");
deleteRecordMap.put("id",CalendarEvent.get("id"));
deleteResp = zoho.crm.invokeConnector("crm.delete",deleteRecordMap);
}
It works but seems awfully inefficient as soon as it's a large number of records - invoking the connector on each loop. Is there a better way to make this work for a big set of records? Is there a limit of number of records or execution time that I'm likely to hit with the above?