Record Module | Related List Module |
Leads | Activities, Visits and Email Drafts |
Contacts | Activities, Visits, Appointments and Email Drafts |
Accounts | Activities, Contacts, Deals, Quotes, Sales Orders, Invoices, Cases, Appointments and Email Drafts |
Deals | Activities, Cases, Competitors and Email Drafts |
Campaigns | Activities, Email Drafts and Child Campaigns |
Cases | Activities and Email Drafts |
Products | Activities, Solutions, Cases and Email Drafts |
Vendors | Activities and Email Drafts |
Quotes | Activities and Email Drafts |
Sales Orders | Activities and Email Drafts |
Purchase Orders | Activities and Email Drafts |
Invoices | Activities and Email Drafts |
Services | Appointments and Email Drafts |
Custom | Activities and Email Drafts |
queryMap = Map(); queryMap.put("select_query","select id from Participants where Training_Program =" + id + "Limit 2000"); response = invokeurl [ type :POST parameters:queryMap.toString() connection:"crm_oauth_connection" ]; |
if(!isNull(response)) { response = response.toMap(); count = response.getJSON("info").get("count").toNumber(); has_more = response.getJSON("info").get("more_records"); id_list = List(); itr_list = {0,1,2,3}; response = response.getJSON("data"); result = List(); if(count > 0) { for each item in response { id_list.add(item.getJSON("id")); } if(count > 100) { end = 0; start = 0; for each itr in itr_list { if(count / 500 - itr > 0) { idMap = Map(); if(count - end > 500) { end = end + 500; } else { end = count; } idMap.put("ids",id_list.subList(start,end)); response = invokeurl [ type :POST parameters:idMap.toString() connection:"crm_oauth_connection" ]; start = end; } } } else { response = invokeurl [ url :"https://www.zohoapis.com/crm/v6/Participants?ids=" + id_list type :DELETE connection:"crm_oauth_connection" ]; } } } |
if(isNull(response) || !has_more) { response = invokeurl [ type :DELETE connection:"crm_oauth_connection" ]; return "Deleted Successfully"; } return "Over 2000 related records were detected. Click 'Cascade Delete' again to delete the remaining and this training program. "; |
Additional Reading |
Custom Buttons: Creating and using custom buttons |
ZOHO CRM Functions: An Overview and setting up functions |
Deluge Script: Introduction to Deluge |
Connections: Working with connections |
Kaizen #80: Types of queries and when to use them |
Kaizen #81: Supported field types in COQL with examples |
Records API: Delete Records |
Mass Action: Mass Delete Records API |
Writer is a powerful online word processor, designed for collaborative work.