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


                                                                                                      ご検討中の方




                                                                                                            • Recent Topics

                                                                                                            • showing Limit exceeded

                                                                                                              Good afternoon...trust you're good. I've been having issues working with but it's not responding. it's showing Limit exceeded, sorry it seems like too many people are working on the sheet right now please try again later. meanwhile no one is working on
                                                                                                            • Sorting columns in Zoho Projects

                                                                                                              Hi, In project management best practice, sorting columns (ascending, descending) is an important tool. Sorting dates to see the order of tasks starting, sorting on priority or even on planned hours is a must for an efficient project control. Currently,
                                                                                                            • Upload API

                                                                                                              I'm trying to use the Upload API to upload some images and attach them to comments (https://desk.zoho.com/DeskAPIDocument#Uploads#Uploads_Uploadfile) - however I can only ever get a 401 or bad request back. I'm using an OAuth token with the Desk.tickets.ALL
                                                                                                            • Losing description after merging tickets

                                                                                                              Hello, We merge tickets when they are about the same topic from the same client. It happens sometimes. We recently noticed that after the merger only the description from the master ticket is left in a thread. And the slave-ticket description is erased.
                                                                                                            • update linked contacts when update happens in account

                                                                                                              Hi, I have a custom field called Licence in the Accounts module. When someone buys a licence, I’d like to update a custom field in the related Contacts. How can I achieve this? I noticed that workflows triggered on Accounts only allow me to update fields
                                                                                                            • Problem Management Module

                                                                                                              I am looking for a Problem Management module within Zoho Desk. I saw in some training videos that this is available, and some even provided an annual price for it. I want an official confirmation on whether this is indeed available. This is not a particularly
                                                                                                            • Unable to explore desk.zoho.com

                                                                                                              Greetings, I have an account with zoho which already has a survey subscription. I would like to explore desk.zoho.com, but when I visit it while logged in (https://desk.zoho.com/agent?action=CreatePortal) I just get a blank page. I have tried different
                                                                                                            • Offline support for mobile app

                                                                                                              Accessing your files and folders from your mobile devices is now quicker and simpler, thanks to the power of offline support. Whether on an Android or iOS device, you can use the Offline function to save files and folders, so you can review them even
                                                                                                            • Zoho Desk KB article embedded on another site.

                                                                                                              We embed KB articles from Zoho Desk on another site (our application). When opening the article in a new tab, there is no issue, but if we choose lightbox, we are getting an error "To protect your security, help.ourdomain.com will not allow Firefox to
                                                                                                            • OPTED FOR STORAGE BY DESCRIPTIVE MISGUIDANCE

                                                                                                              We've opened a domain with three mail ids and payment has also been processed now the bill raised is for single use ID with additional storage capacity. Kindly request you to modify the purchase.
                                                                                                            • List of packaged components and if they are upgradable

                                                                                                              Hello, In reference to the article Components and Packaging in Zoho Vertical Studio, can you provide an overview of what these are. Can you also please provide a list of of components that are considered Packaged and also whether they are Upgradable?
                                                                                                            • Does Attari Messaging app have Bot option and APIB

                                                                                                              Hi, Does Attari also have Bot and API as we use in WhatsApp??
                                                                                                            • How to add application logo

                                                                                                              I'm creating an application which i do not want it to show my organization logo so i have changed the setting but i cannot find where to upload/select the logo i wish to use for my application. I have seen something online about using Deluge and writing
                                                                                                            • Email login error

                                                                                                              Login successfully but email page error
                                                                                                            • Zoho Analytics Regex Support

                                                                                                              When can we expect full regex support in Zoho Analytics SQL such as REGEXP_REPLACE? Sometimes I need to clean the data and using regex functions is the easiest way to achieve this.
                                                                                                            • Change of Blog Author

                                                                                                              Hi, I am creating the blog post on behalf of my colleague. When I publish the post, it is showing my name as author of the post which is not intended and needs to be changed to my colleague's name. How can I change the name of the author in the blogs?? Thanks, Ramanan
                                                                                                            • Show Attachments in the customer portal

                                                                                                              Hi, is it possible to show the Attachments list in the portal for the particular module? Bests.
                                                                                                            • Feature Request - Insert URL Links in Folders

                                                                                                              I would love to see the ability to create simple URL links with titles in WorkDrive. or perhaps a WorkDrive extension to allow it. Example use case: A team is working on a project and there is project folder in WordDrive. The team uses LucidChart to create
                                                                                                            • How to sync from Zoho Projects into an existing Sprint in Zoho Sprints?

                                                                                                              Hi I have managed to integrate Zoho Projects with Zoho Sprints and I can see that the integration works as a project was created in Zoho Sprints. But, what I would like to do is to sync into an existing Zoho Sprints project. Is there a way to make that
                                                                                                            • how to differentiate if whatsapp comes from certain landing page?

                                                                                                              I create a Zobot in SalesIQ to create a Whatsapp bot to capture the lead. I have 2 landing pages, one is SEO optimized and the other want is optimized for leads comes from Google Ads. I want to know from which landing page this lead came through WhatsApp
                                                                                                            • Split my account

                                                                                                              Hello, I recently bought an email service for a friend. But, looks like I used my personal account to buy the plan. Please split the account so that the email service stays in a different account than my personal account.
                                                                                                            • How to record company set up fees?

                                                                                                              Hi all, We are starting out our company in Australia and would appreciate any help with setting up Books accounts. We paid an accountant to do company registration, TFN, company constitution, etc. I heard these all can be recorded as Incorporation Costs, which is an intangible asset account, and amortised over 5 years. Is this the correct way to do it under the current Australian tax regulations? How and when exactly should I record the initial entry and each year's amortasation in Books? Generally
                                                                                                            • Have Mail Lite, wish to add/purchase 2nd domain and use email

                                                                                                              Hello, I have recently created two new businesses. I have successfully used Zoho to create a domain for one business and have set up two email addresses / users on that domain. I am trying to figure out how to create a second domain, just like I did the
                                                                                                            • Show Payment terms in Estimates

                                                                                                              Hi,  we are trying to set up that estimates automatically relates payment terms for the payment terms we introduced on Edit contact (Field Payment terms).  How can it be done? Our aim is to avoid problems on payment terms introduced and do not need to introduce it manually on each client (for the moment we are introducing this information on Terms and Conditions.  Kind Regards, 
                                                                                                            • Search Bar Improvement for Zoho Commerce

                                                                                                              Hey everyone, I've been using Zoho Commerce for a bit now, and I think the search bar could really use an upgrade. Right now, it doesn't show products in a dropdown as you type, which would make finding items a lot faster. On Shopify, for example, you
                                                                                                            • How can I calculate the physical stock available for sale?

                                                                                                              Hey Zoho Team,  I've tried to calculate the physical stock on hand in various ways - but always receive a mismatch between what's displayed in Zoho Inventory & analytics.  Can you please let me know how the physical stock available for sale is calculated?
                                                                                                            • When dispatched to crew, assigning lead missing

                                                                                                              Hello, For the past two or three weeks, whenever an officer assigns Service Appointment to a team, the lead person is missing from the assigned service list. Therefore, we have to reschedule the SA and then the lead person becomes visible in the assigned
                                                                                                            • I want to transfer the project created in this account to another account

                                                                                                              Dear Sir I want to transfer the project created in one account to another account
                                                                                                            • Inactive User Auto Response

                                                                                                              We use Zoho One, and we have a couple employees that are no longer with us, but people are still attempting to email them. I'd like an autoresponder to let them no the person is no longer here, and how they can reach us going forward. I saw a similar
                                                                                                            • Weekly Tips : Customize your Compose for a smoother workflow

                                                                                                              You are someone who sends a lot of emails, but half the sections in the composer just get in your way — like fields you never use or sections that clutter the space. You find yourself always hunting for the same few formatting tools, and the layout just
                                                                                                            • Custom Bulk Select Button

                                                                                                              Zoho CRM offers the ability to select multiple records and invoke a Custom Button This functionality is missing from Recruit Currently we can only add buttons in the detail page and list But we cannot select Multiple Records and invoke a function with
                                                                                                            • Need support in setting up the company email and few other setups

                                                                                                              Need support in setting up the company email and few other setups
                                                                                                            • Power of Automation :: Smart Ticket Management Between Zoho Desk and Projects

                                                                                                              Hello Everyone, A custom function is a software code that can be used to automate a process and this allows you to automate a notification, call a webhook, or perform logic immediately after a workflow rule is triggered. This feature helps to automate
                                                                                                            • Need to set workflow or journey wait time (time delay) in minutes, not hours

                                                                                                              Minimum wait time for both Campaigns workflows and Marketing Automation journeys is one hour. I need one or the other to be set to several minutes (fraction of the hour). I tried to solve this by entering a fraction but the wait time data type is an integer
                                                                                                            • Remote Server is misconfigured

                                                                                                              Dear Team, I am unable to use email id as remote server is misconfigured. It would be really great if you could help on this and get this resolved. Thanks & Regard Rohit Gupta
                                                                                                            • BUG - Google Business Buttons - Add a button to GBP Post

                                                                                                              I am experiencing an issue with the "Add a button" feature when creating posts for my Google Business Profile (GBP) through Zoho Social. When I schedule or publish a GBP post and include a call-to-action button with a specific URL, the post itself publishes
                                                                                                            • This mobile number has been marked spam.

                                                                                                              Dear zoho team, I am very happy to use zoho,because it india 🇮🇳 own app, but when we login into zoho account we facing some issue, please solve below issue ASAP. Add your mobile number As an added security measure for Accounts, you need to verify and
                                                                                                            • Do you have software like Windows software?

                                                                                                              We want swadeshi software
                                                                                                            • Support for Custom Fonts in Zoho Recruit Career Site and Candidate Portal

                                                                                                              Dear Zoho Recruit Team, I hope you're doing well. We would like to request the ability to use custom fonts in the Zoho Recruit Career Site and Candidate Portal. Currently only the default fonts (Roboto, Lato, and Montserrat) are available. While these
                                                                                                            • Trying to export a report to Excel via a deluge script

                                                                                                              I have this code from other posts but it gives me an error of improper statement, due to missing ; at end of line or incomplete expression. Tried lots of variations to no avail. openUrl(https://creatorapp.zoho.com/<username>/<app name>/XLSX/#Report:<reportname>,"same
                                                                                                            • Next Page