For Zoho Services only:

I'm actually part of a bigger team at Ascent Business Solutions where we have support technicians and project consultants. Support is for smaller technical fixes but this can include developments, reports or integrations; depending on the size of the task. Projects are for more time-consuming developments such as revamps of the Zoho Suite of apps or on-site training. The advantage of a team is that if I am out-of-office for a day or so, there is always someone at Ascent Business Solutions who can deal with any queries/issues you may have.

Our support rates can be found and purchased at A support bundle doesn't have an expiry date. So whether we can do what you want within the bundle and a year later need further support, if there are minutes left on the bundle then there is no additional charge.

Our project rates for bigger developments can be found at and will involve a dedicated project consultant along with developers who will hold your hand through the development process.

If you want help building a solution for one of the Zoho Apps in the Zoho Suite, contact us on 0121 293 8140 (UK) or by email at You can also visit our website at

I regularly build and specialize in 2-way API integrations for Xero, Shopify and eBay.

Zoho Deluge: Duplicate/Clone a Record

This is an article with the snippet of code required to duplicate or clone a record in Zoho CRM using Zoho Deluge.

The aim here is to have a scheduled task that on the 1st of every month, takes the invoices for the month before, and duplicates each one for the new month.

First you have to get all the applicable fields from the settings API. In API v2, you have to do it this way apparently. So setup a Zoho Oauth connector (see the end of this article if you don't know how), I'm going to call mine myZohoConnector, with the scope:
  1.  ZohoCRM.settings.fields.READ 
Then check your URL is correct. The format for API v2 is:
https://www.zohoapis.{eu or com}/crm/v2/settings/fields?module={module-name}
  1.  https://www.zohoapis.{eu or com}/crm/v2/settings/fields?module={module-name} 
You can then use the following snippet to get all the fields for the module. In our case, for "Invoices":
Function: fn_Button_CloneInvoice
Purpose: This function duplicates a CRM invoice
Parameters: p_InvoiceID (CRM ID of the invoice)
Returns: Nothing

Author: Joel Lipman
Date Created: 2020-03-17

// get all field names for the Invoices module via API
l_FieldApiNames = List();
r_Fields = invokeurl
	url :""
	type :GET
	for each  r_Field in r_Fields.get("fields")

// get details of original invoice
r_Invoice = zoho.crm.getRecordById("Invoices", p_InvoiceID);

// start map
m_Clone = Map();

// loop through field names
for each  v_FieldName in l_FieldApiNames

// now override fields specific to the newly cloned/duplicated record
m_Clone.put("Invoice_Status","Repeated Invoice");

// create the record
r_Clone = zoho.crm.createRecord("Invoices",m_Clone);

// get cloned invoice ID
	v_Duplicate_InvoiceID = r_Clone.get("id");
  1.  /* 
  2.  Function: fn_Button_CloneInvoice 
  3.  Purpose: This function duplicates a CRM invoice 
  4.  parameters: p_InvoiceID (CRM ID of the invoice) 
  5.  Returns: Nothing 
  7.  Author: Joel Lipman 
  8.  Date Created: 2020-03-17 
  9.  */ 
  11.  // get all field names for the Invoices module via API 
  12.  l_FieldApiNames = List()
  13.  r_Fields = invokeUrl 
  14.  [ 
  15.      url :"" 
  16.      type :GET 
  17.      connection:"myzohoconnector" 
  18.  ]
  19.  if(!isnull(r_Fields.get("fields"))) 
  20.  { 
  21.      for each  r_Field in r_Fields.get("fields") 
  22.      { 
  23.          l_FieldApiNames.add(r_Field.get("api_name"))
  24.      } 
  25.  } 
  27.  // get details of original invoice 
  28.  r_Invoice = zoho.crm.getRecordById("Invoices", p_InvoiceID)
  30.  // start map 
  31.  m_Clone = Map()
  33.  // loop through field names 
  34.  for each  v_FieldName in l_FieldApiNames 
  35.  { 
  36.      if(!isNull(r_Invoice.get(v_FieldName))) 
  37.      { 
  38.          m_Clone.put(v_FieldName,r_Invoice.get(v_FieldName))
  39.      } 
  40.  } 
  42.  // now override fields specific to the newly cloned/duplicated record 
  43.  m_Clone.put("Invoice_Status","Repeated Invoice")
  44.  m_Clone.put("Invoice_Date",zoho.currentdate.toString("yyyy-MM-dd"))
  45.  m_Clone.put("Due_Date",zoho.currentdate.addMonth(1).toStartOfMonth().subDay(1).toString("yyyy-MM-dd"))
  47.  // create the record 
  48.  r_Clone = zoho.crm.createRecord("Invoices",m_Clone)
  50.  // get cloned invoice ID 
  51.  if(!isNull(r_Clone.get("id"))) 
  52.  { 
  53.      v_Duplicate_InvoiceID = r_Clone.get("id")
  54.  } 

Additional Note(s):
  • Invoice_Date in this example is the current date in format yyyy-MM-dd
  • Due_Date in this example is at the end of the current month: so add 1 month, go to the start of that month, subtract 1 day. .toEndOfMonth() used to work but appears to be deprecated.
  • Invoice_Ref_ID is excluded from being copied as it was an autonumber in our example.
  • is used in the above example for a client on the EU datacenters. If your datacenter is in the US then this should be

Additional Additional(s):
I haven't done any benchmark tests on this to compare but looking at different ways to exclude elements from a list:
info l_FieldApiNames;
l_FieldApiNames = {"a","b","c","d","e"};

l_ExcludeFields = {"b","d"};
for each  v_FieldName in l_ExcludeFields
info l_FieldApiNames;

// yields: 
// a,b,c,d,e
// a,c,e

// compared to:
for each  v_FieldName in l_FieldApiNames
		... do stuff here ...

// notes:
// no need to check if element exists on "removeElement"
  1.  info l_FieldApiNames; 
  2.  l_FieldApiNames = {"a","b","c","d","e"}
  4.  l_ExcludeFields = {"b","d"}
  5.  for each  v_FieldName in l_ExcludeFields 
  6.  { 
  7.      l_FieldApiNames.removeElement(v_FieldName)
  8.  } 
  9.  info l_FieldApiNames; 
  11.  // yields: 
  12.  // a,b,c,d,
  13.  // a,c,
  15.  // compared to: 
  16.  for each  v_FieldName in l_FieldApiNames 
  17.  { 
  18.      if(!l_ExcludeFields.contains(v_FieldName)) 
  19.      { 
  20.          ... do stuff here ... 
  21.      } 
  22.  } 
  24.  // notes: 
  25.  // no need to check if element exists on "removeElement" 

Zoho OAuth Connector
Just in case you don't know how to setup a Zoho OAuth Connector, here's how you do it in CRM:
  1. Login to Zoho CRM as an administrator and go to Setup
  2. Under Developer Space click on "Connections"
  3. Under Pick your Service click on "Zoho OAuth" (NOT "Zoho" - there are 2 Zoho options)
  4. Give the connection a name such as "myZohoConnector"
  5. Tick the applicable Scope(s): for example: "ZohoCRM.settings.fields.READ"
  6. Click on "Create" and then on "Accept" in the popup.
  7. You should be redirected to a page which lists the "status" as connected as well as a snippet of Deluge for the usage

Category: Zoho :: Article: 712

Related Articles

Joes Revolver Map


Badge - Certified Zoho Creator Associate
Badge - Certified Zoho Creator Associate

Donate & Support

If you like my content, and would like to support this sharing site, feel free to donate using a method below:

Donate to Joel Lipman via PayPal

Donate to Joel Lipman with Bitcoin - Valid till 8 May 2022 3QnhmaBX7LQSRsC9hh6Je9rGQKEGNQNfPb
© 2021 Joel Lipman .com. All Rights Reserved.