Function-7: Add Country codes to contact numbers.

Function-7: Add Country codes to contact numbers.


Welcome back everyone! 

Last week, we learnt how tosum up the total across multiple quotes associated to a deal. This week, let's look at a custom function that allows you to add the country codes to mobile numbers that makes it convenient to make calls directly from CRM.

Business scenario:

Web forms is one of the easiest ways to generate leads in most organizations. Be it an access form that lets prospects watch an on-demand webinar, or a 'Contact us' form that a prospect fills out to reach you, this is one activity that you cannot do away with. However, not all prospects fill out the complete details, do they? Zoho CRM's Phonebridge support lets you make direct calls from within the CRM. This week's custom function saves you the pain of having to edit the record manually to update the country code.

Add this custom function to any module including the custom ones. Change the module name and field names in the code and add the function to the module.

Getting started with the custom function:

Lets assume an example where you add the country code +91(India) to records in the Leads and Contacts module.

For the Lead module:

  1. Go to Setup > Automations > Actions > Custom Functions > Configure Custom Function > Write your own .
  2. Provide a name for the custom function. For example: “Add Country code-1”. Add a description(optional).
  3. Select the module as Leads . Add a description(optional).
  4. Click “ Free flow scripting ”.
  5. Copy the code given below.
  6. Click “ Edit arguments ”.
  7. Enter the name as “ leadId ” and select the value as “ Lead Id ”.
  8. Save the changes.
For the Contacts module:

  1. Go to Setup > Automations > Actions > Custom Functions > Configure Custom Function > Write your own.
  2. Provide a name for the custom function. For example: “Add Country code-2”. Add a description(optional).
  3. Select the module as Contacts . Add a description(optional).
  4. Click “ Free flow scripting ”.
  5. Copy the code given below.
  6. Click “ Edit arguments ”.
  7. Enter the name as “ contactId ” and select the value as “ Contact Id ”.
  8. Save the changes.
The script:

Code for Version 2.0 API:
 
For the Leads module: 

leadDetails = zoho.crm.getRecordById("Leads", input.leadId.toLong()); 
mobile = ifnull(leadDetails.get("Mobile"),""); 
phone = ifnull(leadDetails.get("Phone"),""); 
mp = map(); 
mp.put("Mobile", "+91" + mobile); 
mp.put("Phone", "+91" + phone); 
update = zoho.crm.update("Leads", leadId.toLong(), mp); 
info update; 
info mp; 

For the Contacts module: 

acctDetails = zoho.crm.getRecordById(("Contacts"), input. contactId.toLong()); 
phone = ifnull(acctDetails.get("Phone"),""); 
fax = ifnull(acctDetails.get("Fax"),""); 
mp = map(); 
mp.put("Phone", "+91" + phone); 
mp.put("Fax", "+91" + fax); 
update = zoho.crm.update(("Contacts"), contId.toLong(), mp); 
info update; 
info mp; 

Code for Version 1.0 API:

For the Leads module:

leadIdStr = input.leadId.toString();
leadDetails = zoho.crm.getRecordById("Leads", input.leadId);
mobile = ifnull(leadDetails.get("Mobile"),"");
phone = ifnull(leadDetails.get("Phone"),"");
mp = map();
mp.put("Mobile", "+91" + mobile);
mp.put("Phone", "+91" + phone);
update = zoho.crm.updateRecord("Leads", leadIdStr, mp);
info update;
info mp;

For the Contacts module:

contIdStr = input.contactId.toString();
acctDetails = zoho.crm.getRecordById(("Contacts"), input. contactId);
phone = ifnull(acctDetails.get("Phone"),"");
fax = ifnull(acctDetails.get("Fax"),"");
mp = map();
mp.put("Phone", "+91" + phone);
mp.put("Fax", "+91" + fax);
update = zoho.crm.updateRecord(("Contacts"), contIdStr, mp);
info update;
info mp;

Note:

  • Change the country code from +91 to any preferred country code in the code.
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

                                                            • Zoho CRM Functions 53: Automatically name your Deals during lead conversion.

                                                              Welcome back everyone! Last week's function was about automatically updating the recent Event date in the Accounts module. This week, it's going to be about automatically giving a custom Deal name whenever a lead is converted. Business scenario Deals are the most important records in CRM. After successful prospecting, the sales cycle is followed by deal creation, follow-up, and its subsequent closure. Being a critical function of your sales cycle, it's good to follow certain best practices. One such
                                                            • User Tips: Auto-Create Opportunity/Deal upon Quote Save (PART 1)

                                                              Problem: We use quotes which convert to sales orders but Users / Sales Reps do not create opportunities / deals and go straight to creating a quote. This leads to poor reporting. Implementing this solution improves reporting and makes it easier for users.
                                                            • Custom Function : Automatically send the Quote to the related contact

                                                              Scenario: Automatically send the Quote to the related contact.  We create Quotes for customers regularly and when we want to send the quote to the customer, we have to send it manually. We can automate this, using Custom Functions. Based on a criteria, you can trigger a workflow rule and the custom function associated to the rule and automatically send the quote to customer through an email. Please note that the quote will be sent as an inline email content and not as a PDF attachment. Please follow
                                                            • Function #50: Schedule Calls to records

                                                              Welcome back everyone! Last week's function was about changing ownership of multiple records concurrently. This week, it's going to be about scheduling calls for records in various modules. Business scenario Calls are an integral part of most sales routines.. Sales, Management, Support, all the branches of the business structure would work in cohesion only through calls. You could say they are akin to engine oil, which is required by the engine to make all of it's components function perfectly. CRM
                                                            • Function #37: Create a Purchase Order from a Quote

                                                              Welcome back everyone! Last week, we learnt how to calculate the total number of activities for a lead and further take note of the activity count for particular dates. For instance, from the period of Demo to Negotiation. This week, let's look at a function that lets you create a Purchase Order instantly from a Quote. Business scenario: In any form of business, one of the most important things to do is to document the transactions. Naturally, negotiation, signing an agreement, placing an order,


                                                            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

                                                                                                            • can I link a contacts to multiple accounts

                                                                                                              can I link a contacts to multiple accounts
                                                                                                            • Rotate an Image in Workdrive Image Editor

                                                                                                              I don't know if I'm just missing something, but my team needs a way to rotate images in Workdrive and save them at that new orientation. For example one of our ground crew members will take photos of job sites vertically (9:16) on his phone and upload
                                                                                                            • Free webinar! Digitize recruitment and onboarding with Zoho Sign and Zoho Recruit

                                                                                                              Hello, Tired of being buried in onboarding paperwork? With the integration between Zoho Sign and Zoho Recruit, a powerful applicant tracking system, you can digitize and streamline the entire recruitment and onboarding process, all from one platform.
                                                                                                            • Resume Harvester: New Enhancements for Faster Sourcing

                                                                                                              We’re excited to share a set of enhancements to Resume Harvester that make sourcing faster and more flexible. These updates help you cut down on repetitive steps, manage auto searches more efficiently, and review candidate profiles with ease. Why we built
                                                                                                            • is it possible to add more than one Whatsapp Phone Number to be integrated to Zoho CRM?

                                                                                                              so I have successfully added one Whatsapp number like this from this User Interface it seems I can't add a new Whatsapp Number. I need to add a new Whatsapp Number so I can control the lead assignment if a chat sent to Whatsapp Phone Number 1 then assign
                                                                                                            • Open Activities view.

                                                                                                              I really like the new views for the open and closed activities inside the deals. But when you are in the tab view instead of the column view you can only complete and edit the open activity there isn't the 3 dot option to be able to delete the activ
                                                                                                            • Potentially Outdated and Vulnerable Chromium Engine Installed by Ulaa Browser Installer

                                                                                                              I just installed Ulaa Browser a few minutes ago. Whats My Browser page shows I am using an outdated Chromium engine meaning I might be vulnerable for security exploits that might have got fixed in the new version.
                                                                                                            • Potentially hardcoded list of Browsers to import from (after Ulaa Setup)

                                                                                                              I have just installed Ulaa Browser and found that the list of browser to import data is potentially hardcoded ones rather than looking at the system. I do not have FF, IE and Edge is not my default itself. I would appreciated if Ulaa detected my browsers
                                                                                                            • Fat Download of Ulaa Browser

                                                                                                              I just observed that Ulaa Browser is offering an one-capsule big download. These days it is a custom to offer a small bootstrap downloader and based on user customization options an appropriate download completes. And this is particularly common with
                                                                                                            • Remember all the ways we've posted?

                                                                                                              The world celebrates World Postal Day in 2025 with the theme “#PostForPeople: Local Service. Global Reach". The story of the “post” is a story of human connection itself, evolving from simple handwritten notes carried over long distances to instant digital
                                                                                                            • From Layout to Code: Finding Custom Field IDs in Zoho Projects.

                                                                                                              Hello everyone! Ever found yourself wondering how to get the API names and IDs of custom fields in Zoho Projects while working on custom functions? Here’s a simple and effective way to do it! This method makes it super easy to locate the right field details
                                                                                                            • How to notify all members on any updates to zoho crm?

                                                                                                              Hi, I am using the free version of zoho CRM and currently seeing this will work for our company. We are a small company and wanted to be more informed about all the changes in zoho.   1. How do I set notifications that go to the team for any and all changes made in Zoho. At this point, we'd rather be over-informed than under-informed. 2. Create a custom field (or rename an unused field) to be able to capture any "Product Feature Requests" from customers or prospects we're talking to. I have anyone
                                                                                                            • How can I transfer data from Production to Development environment?

                                                                                                              Hi, I am using Creator V6 and would like to bring all the data in production to the Development and Testing environments? Is there an easy way of doing that or I have to export and import each table?
                                                                                                            • Billing frequency is not displayed correctly.

                                                                                                              Hello There is an issue while displaying the billing frequency on a subscription quote. I am able to activate the subscription details and get this lovely overview: If I am adding a Plan which I charge quarterly, first of all it should be possible to
                                                                                                            • Calling Function via REST API with API Key gives 401 using Zoho Developer

                                                                                                              Hi, I created a couple of functions using the one month trial of Enterprise edition, which I was able to call using the API Key method from Postman and from an external site. Now that my trial has expired, I have created the same functions in the Developer
                                                                                                            • Session Expired

                                                                                                              I constantly get "Session Expired" and need to relogin or close and open the application again. This gets really frustrating during the day. Is this something that can be solved? This really makes me want to leave the app as it is no go to need to reopen
                                                                                                            • Employee type and source translation

                                                                                                              In Zoho People, when I fill in the employee’s information, there is the option to determine the type of employment (employee type) and the hiring source. Both options ALWAYS appear in English. It is extremely inconvenient to deal with poorly translated
                                                                                                            • Sync Issue Between Zoho Notebook Web App on Firefox (PC) and Android App

                                                                                                              Hi Zoho Notebook Community, I'm facing a sync problem with Zoho Notebook. When I use the web version on Mozilla Firefox browser on my PC, I create and save new notes, and I've synced them successfully. However, these new notes aren't showing up in my
                                                                                                            • Request for Clarity on Timeline for True GPT/Zia Auto-Response Capabilities

                                                                                                              I appreciate Zoho’s steady innovation, but I’m concerned that Desk and Zia remain well behind modern AI capabilities. For years, GPT-based tools have been able to generate and send contextual responses, yet Zoho Desk only supports summarization or suggested
                                                                                                            • Notebook audio recordings disappearing

                                                                                                              I have recently been experiencing issues where some of my attached audio recordings are disappearing. I am referring specifically to ones made within a Note card in Notebook on mobile, made by pressing the "+" button and choosing "Record audio" (or similar),
                                                                                                            • In arattai received message can't be deleted

                                                                                                              The issue has been noticed in following: arattai app (Android) arattai app (Window) arattai web While the message posted by me may be deleted, the ones received from others can't be. The item <Delete> change to <Report> when the message is a received
                                                                                                            • Has anyone built a ticket export that allows Help Center users to export the tickets shown in the My Area list they are looking at?

                                                                                                              Hi, We are moving to Zoho Desk soon. Our current support system displays an option in our help center allowing customers to export their Open, Closed, or all tickets based on which list they are looking at. We need to offer the same in Zoho Desk help
                                                                                                            • Two factor authentication for helpdesk users

                                                                                                              The company i work for wants use the helpdesk site in Zoho desk, as a place for their distribution partners to ask question and look for information about our product. The things there is suppose to go up there is somewhat confidential between my company
                                                                                                            • Zoho Desk: Q2 2025 | What's New

                                                                                                              Hello everyone, We are excited to announce Zoho Desk's 2025 Autumn updates. This release brings new features and enhancements that improve work management and enable businesses to provide a better overall support experience. Spanning from Zia Agents to
                                                                                                            • Change text in help desk

                                                                                                              Hi, Please let me know how can i change the this text, see screenshot.
                                                                                                            • Items Below Reorder Point Report?

                                                                                                              Is there a way to run a report of Items that are below the Reorder Point? I don't see this as a specific report, nor can I figure out how to customize any of the other stock reports to give me this information. Please tell me I'm missing something s
                                                                                                            • Blog Widget: Show recent blog posts on my homepage

                                                                                                              Hey there I am using the Zoho Sites Blog feature. On my homepage, on the bottom I'd like to have a featured content section where I show some of my blog posts (selected, most recent, filtered by category and so on...). It would be nice to have a blog
                                                                                                            • Committed Stock and To Be Received Stock via API?

                                                                                                              Is it possible to retrieve Committed Stock and/or To Be Received Stock for an Item via the API? I want to use this information for calculating the amount of inventory needed to be purchased.
                                                                                                            • Zoho Books | Product updates | October 2025

                                                                                                              Hello users, We’ve rolled out new features and enhancements in Zoho Books. From iOS 26 updates to viewing reports as charts, explore the updates designed to enhance your bookkeeping experience. Zoho Books Updates for Apple Devices At WWDC 2025, Apple
                                                                                                            • Improved RingCentral Integration

                                                                                                              We’d like to request an enhancement to the current RingCentral integration with Zoho. RingCentral now automatically generates call transcripts and AI-based call summaries (AI Notes) for each call, which are extremely helpful for support and sales teams.
                                                                                                            • Cannot reject empty expense report

                                                                                                              Hello, We are currently having issues with two empty expense reports where if we try to reject them, either manually or through the REST API, we get error 114016, which says some of the expenses have already been billed and must be removed. I'd appreciate
                                                                                                            • Having Trouble Opening The Candidate Portal

                                                                                                              Recently am having trouble opening the Candidate Portal. It keeps loading but cannot display any widgets. Tried Safari, Chrome and Edge. Non of them work. Please solve the problem ASAP.
                                                                                                            • Checkboxes not adhering to any policy in mail merge - data from CRM

                                                                                                              I want checkboxes to appear depending on whether the checkbox in the CRM module is ticked or not. However, the tickboxes that appear are either ticked or not, but don't correlate to the actual selections in the CRM module. This is is despite updating
                                                                                                            • Items Landed Cost and Profit?

                                                                                                              Hello, we recently went live with Zoho Inventory, and I have a question about the Landed Cost feature. The FAQ reads: "Tracking the landed cost helps determine the overall cost incurred in procuring the product. This, in turn, helps you to decide the
                                                                                                            • Show elapsed time on the thank-you page?

                                                                                                              Is it possible to display the total time a user spent filling out a Zoho Form on the thank-you? I’d like to show the difference between the `form submission timestamp` and the `start time` (currently have a hidden Date-Time field set to autofill the date
                                                                                                            • CC and/or BCC users in email templates

                                                                                                              I would like the ability to automatically assign a CC and BCC "User (company employee)" into email templates. Specifically, I would like to be able to add the "User who owns the client" as a CC automatically on any interview scheduled or candidate submitted
                                                                                                            • All new Address Field in Zoho CRM: maintain structured and accurate address inputs

                                                                                                              The address field will be available exclusively for IN DC users. We'll keep you updated on the DC-specific rollout soon. It's currently available for all new sign-ups and for existing Zoho CRM orgs which are in the Professional edition. Managing addresses
                                                                                                            • Create Contract API Endpoint Unclear "inputfields" Requirements

                                                                                                              Hello, I'm trying to create a Deluge function that accepts inputs from a form in Zoho Creator and creates a barebones contract of a given type. See below for the current code, cleaned of authentication information. // Fetch form data // Hidden field client_name
                                                                                                            • Empowered Custom Views: Cross-Module Criteria Now Supported in Zoho CRM

                                                                                                              Hello everyone, We’re excited to introduce cross-module criteria support in custom views! Custom views provide personalized perspectives on your data and that you can save for future use. You can share these views with all users or specific individuals
                                                                                                            • Kaizen #46 - Handling Notes through Zoho CRM API (Part 1/2)

                                                                                                              Hello everyone! Welcome back to another week of Kaizen! This week, we will discuss Handling Notes through Zoho CRM API. What will you learn from this post? Notes in Zoho CRM Working with Notes through Notes APIs 1. Notes in Zoho CRM 1a. Why add Notes to records? Notes are a great way to summarize your observations on customer and prospect interactions and outcomes. By saving notes as CRM data, a sales rep will always be able to keep track of how a sale is progressing. To know more about notes in
                                                                                                            • Next Page