Function-31: Get the timezone of your leads

Function-31: Get the timezone of your leads



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.

Last week, we learnt how to keep track of your business details with a Company or a Contact . This week, let's look at a function that lets you automatically get the time zone of your leads, so as to help in deciding the best time to contact.

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:
  1. Go to Setup > Developer Space > Functions > + Create New Function.
  2. Select Automation as Function type and click Next.
  3. Provide a name for the function. For example: “Lead Time Zone”. Add a description(optional).
  4. Copy the code given below.
  5. Click “Edit arguments”.
  6. Enter the name as “leadId” and select the value as “Lead Id”.
  7. Enter the name as "zip" and select the value as "Zip Code".
  8. Click Save&Execute Script.
  9. Click Save.

The script:

Code for Version 2.0 API:

data = getUrl("https://maps.googleapis.com/maps/api/geocode/json?address=" + zip + "&key=xxxxxxxx");
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");
timezone = getUrl("https://maps.googleapis.com/maps/api/timezone/json?location=" + lat + "," + long + "&timestamp=0900000000&key=yyyyyyyy").getJSON("timeZoneName");
update = zoho.crm.update("Leads", leadid.toLong(), {"Time_Zone": timezone});
info update;

Code for Version 1.0 API:

data = getUrl(" https://maps.googleapis.com/maps/api/geocode/json?address= " + zip + "&key=xxxxxxxx");
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");
timezone = getUrl(" https://maps.googleapis.com/maps/api/timezone/json?location=" + lat + "," + long + "&timestamp=0900000000&key=yyyyyyyy").getJSON("timeZoneName");
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!

Update: As you must be aware, API V1.0 will be deprecated and support for version 1.0 API will be available only till Dec 31, 2018. Version 1.0 compatible Functions will continue to work until Dec 31, 2019. You're advised to migrated to API Version 2.0 at the earliest. Check this  announcement  for more. We've updated the post to include the Version 2.0 compatible Function.

    Access your files securely from anywhere











                            Zoho Developer Community





                                                  • Desk Community Learning Series


                                                  • Digest


                                                  • Functions


                                                  • Meetups


                                                  • Kbase


                                                  • Resources


                                                  • Glossary


                                                  • Desk Marketplace


                                                  • MVP Corner


                                                  • Word of the Day


                                                  • Ask the Experts



                                                            • Sticky Posts

                                                            • How to reach the official Zoho Support channels and avoid fake ones.

                                                              Dear Customers, Thanks a lot for choosing Zoho! Our applications are built to help achieve your day-to-day business goals. We are committed to engaging with you, to understand and develop solutions that enhance your productivity.  We are happy and ready to help you use our services effectively. Understanding and avoiding fake support Just like using popular bank names and financial applications for phishing purposes, using Zoho and claiming to be providing Zoho Support or services with false numbers
                                                            • Function #35: Close all tasks associated with a lead and create a new task.

                                                              Welcome back everyone! Last week, we learnt how to close all tasks of a deal depending upon the deal stage. This week, let's look at a custom function that lets you close all of the tasks associated with a lead while simultaneously creating a new task, like when you need to halt all progress towards a lead while the lead is not available at the moment but create a reminder task. Business scenario: The success of a company, in one way or another, is determined by the leads it gets. Each lead is just
                                                            • Zoho CRM Webinar - Redesigning Daily User Experiences with Canvas

                                                              <br> Your users across roles use the CRM for day-to-day tasks that are necessary. Whether they perform their tasks on time, the right way, or at all depends on a lot of factors, including User Experience. Many businesses struggle with rigid layouts,
                                                            • Join us at the Canada ZUG Meetup: What’s New in Zoho CRM

                                                              Hello Zoho Community! Start your year with fresh insights into Zoho CRM’s latest updates and tools. Whether you're a CRM beginner or a experienced user, this meetup is crafted to help you optimise your processes and leverage new features. Explore practical
                                                            • CRM Hack #2: Automate sending of birthday greetings to your customers.

                                                                Hello everyone! What sets you apart as a sales person is your ability to add that personal touch to your business relationship with your customers. Sending a gift on a special day, or leaving a note wishing them on their birthdays, are small, yet significant actions that show your customers that you care. And these are actions done without any expectations :) You must be engaging with a lot of customers and it is highly unlikely that they all are your friends on Facebook or some social channel,


                                                            Manage your brands on social media



                                                                  Zoho TeamInbox Resources



                                                                      Zoho CRM Plus Resources

                                                                        Zoho Books Resources


                                                                          Zoho Subscriptions Resources

                                                                            Zoho Projects Resources


                                                                              Zoho Sprints Resources


                                                                                Qntrl Resources


                                                                                  Zoho Creator Resources



                                                                                      Zoho CRM Resources

                                                                                      • CRM Community Learning Series

                                                                                        CRM Community Learning Series


                                                                                      • Kaizen

                                                                                        Kaizen

                                                                                      • Functions

                                                                                        Functions

                                                                                      • Meetups

                                                                                        Meetups

                                                                                      • Kbase

                                                                                        Kbase

                                                                                      • Resources

                                                                                        Resources

                                                                                      • Digest

                                                                                        Digest

                                                                                      • CRM Marketplace

                                                                                        CRM Marketplace

                                                                                      • MVP Corner

                                                                                        MVP Corner







                                                                                          Design. Discuss. Deliver.

                                                                                          Create visually engaging stories with Zoho Show.

                                                                                          Get Started Now


                                                                                            Zoho Show Resources


                                                                                              Zoho Writer Writer

                                                                                              Get Started. Write Away!

                                                                                              Writer is a powerful online word processor, designed for collaborative work.

                                                                                                Zoho CRM コンテンツ




                                                                                                  Nederlandse Hulpbronnen


                                                                                                      ご検討中の方