loader

For this tutorial in video form, click here

In this article, we’re going to go over creating records in Zoho CRM via Deluge Script. Our first step will be to consult the Deluge docs. This page has some helpful examples of how to create new records including bonuses like adding notes to a record.

One of the key points the docs page leaves out is API names. When you create new records in Zoho CRM, you have to map the API names for the fields you want to set. An example of an API name is First_Name – the field shows up as First Name in the CRM but when you’re using Deluge to insert records, you have to use First_Name. Sometimes there is no relationship between the field label and the API name. Quite often fields get renamed multiple times and you end up with a scenario where the field name is “Products Of Interest” but the API name is Products_They_Like.

For this reason, it’s best to double check what the API names are before you write any code. We can find API names by going to Setup > Developer Space > APIs. Here, you’ll want to click on “API names”:

Then choose the module you’re after. This will show you the golden ticket:

Once you’ve figured out the API names, you can then start using zoho.crm.createRecord to add new records.

Here’s an example where we create a new lead when we receive a missed call from an unknown number:

call_record = zoho.crm.getRecordById("Calls", call_id);
subject = call_record.get("Subject");
subject_parts = subject.toList("Missed call from ");
if(subject_parts.size() == 2)
{
	number = subject_parts.get(1);
	if(number.startsWith("+"))
	{
		new_lead_payload = {"First_Name":"Unknown","Last_Name":"Created from missed call from " + number, "Phone": number};
		create_resp = zoho.crm.createRecord("Leads",new_lead_payload,{"trigger":{"workflow"}});
		new_lead_id = create_resp.get("id");
	}
}

Conclusion

Now that you know how to find API names and the basic syntax of using zoho.crm.createRecord, nothing can stop you from filling your CRM with new records 🙂 Hope it helps you close new deals and improve the experience for your existing customers.

For this tutorial in video form, click here