Welcome back everyone!
I'm sure most of you already know this, but we have introduced the newer version of
Zoho APIs (Version 2.0)
. Functions(previously, Custom Functions) also underwent an update, regarding the said APIs and some more. However, this week's function still uses the Version 1.0. Zoho APIs, because the transition from v1.0 to v2.0 is still in progress. Stay tuned for more updates.
Business scenario:
It’s a no brainer that prompt call backs and engagement right through the purchase cycle have a direct bearing on your lead conversion. To do this, it is very important that you call/email your clients in their time zone. Wouldn’t it be great if your CRM automatically sorts your leads based on their time zone? The Function (custom function) I share today helps you do just that.
Add this function to the Leads module and fetch the time zone of the leads based on their address. We will make use of Google APIs to meet this requirement. Create a custom field in Leads module to capture the time zone details. Furthermore, you get the list view of the Leads module to display the time zone along with the name, contact number and the other fields. Segregate your clients based on their time zone and target your nurture programs accordingly. This ensures your sales calls and emails are addressed at the right time and help you win more deals.
Getting started with the function:
- Go to Setup > Developer Space > Functions > + Create New Function.
- Select Automation as Function type and click Next.
- Provide a name for the function. For example: “Lead Time Zone”. Add a description(optional).
- Copy the code given below.
- Click “Edit arguments”.
- Enter the name as “leadId” and select the value as “Lead Id”.
- Enter the name as "zip" and select the value as "Zip Code".
- Click Save&Execute Script.
- Click Save.
The script:
Code for Version 2.0 API:
result = data.getJSON("results");
geometry = result.toJSONList().get(0).getJSON("geometry").toJSONList();
location = geometry.get(0).getJSON("location");
lat = location.getJSON("lat");
long = location.getJSON("lng");
update = zoho.crm.update("Leads", leadid.toLong(), {"Time_Zone": timezone});
info update;
Code for Version 1.0 API:
result = data.getJSON("results");
geometry = result.toJSONList().get(0).getJSON("geometry").toJSONList();
location = geometry.get(0).getJSON("location");
lat = location.getJSON("lat");
long = location.getJSON("lng");
update = zoho.crm.updateRecord("Leads", leadid.toString(), {"Time Zone": timezone});
------------------------------------------------------------------------------------------------------------------------
Note:
Found this useful? Try it out and let me know how it works! If you have questions, do not hesitate to ask! Share this with your team if you find it useful. Do check out other custom functions shared in this series
here
.
See you all next week with another interesting custom function. Ciao!