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




                                      Zoho Desk Resources

                                      • Desk Community Learning Series


                                      • Digest


                                      • Functions


                                      • Meetups


                                      • Kbase


                                      • Resources


                                      • Glossary


                                      • Desk Marketplace


                                      • MVP Corner


                                      • Word of the Day



                                          Zoho Marketing Automation
                                                  • 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
                                                  • 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,
                                                  • Function-2: Round-Robin assignment of records

                                                    Welcome back folks! Last week, we saw how to update sales commission in quotes using a custom function. This week, let's see an interesting use case asked by many of you - auto-assignment records by round-robin method. Business scenario: Right now, the solution allows you to auto-assign leads from web form and imported lists. Let us look at a need where you want to auto-assign leads from in-bound calls in a round-robin method, across modules. Prerequisite: You must create a permanent record in the


                                                  Manage your brands on social media



                                                        Zoho TeamInbox Resources

                                                          Zoho DataPrep 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

                                                                                                  • Customise 404 page in Zoho Sites 2.0

                                                                                                    Is it possible to customise the 404 page in Zoho Sites 2? You use to create a new 404 page and that became the default 404 page, but this does not seem to work anymore? Any pointers/suggestions/support appreciated :)
                                                                                                  • [Important announcement] Zoho Writer will mandate DKIM configuration for automation users

                                                                                                    Hi all, Effective Dec. 31, 2024, configuring DKIM for From addresses will be mandatory to send emails via Zoho Writer. DKIM configuration allows recipient email servers to identify your emails as valid and not spam. Emails sent from domains without DKIM
                                                                                                  • Create workflow rules based on notes

                                                                                                    Last modified on 17/04/2023: Creating Workflow rules based on notes is now available for all Zoho CRM users in all DCs. Note that it was an early access feature available only upon request. As of April 13, 2023, it is rolled out for al Zoho CRM accounts.
                                                                                                  • Workflow sync between zoho books and zoho inventory

                                                                                                    Hello, While the custom fields, validation rules and even custom buttons are sync'd between zoho books and zoho inventory, the workflow rules do not. Not sure if this is an intentional purpose of zoho team for some good reason or if it's in the development
                                                                                                  • HOW TO USE ZOHO

                                                                                                    IDK
                                                                                                  • Item sales account via api

                                                                                                    Hey everyone, I’m making an invoice using the create invoice endpoint on the api. Is it possible to set a sales account in the line_items attributes?
                                                                                                  • Zoho Please change your ways

                                                                                                    I started using Your new Zoho bookings in earnest 3 days ago. What a mistake.  Once again, everything is backwards and upside down.  I had to spend 5 hours testing how the thing works in order for me to understand how to acutally use it.  When i started using google calendar years ago.  it took seconds to figure out how it works. Why is that. bc they put everything in places where it makes sense.  Today, I needed to add an appointment as well as a time off.  Stupid me i added the time off first,
                                                                                                  • Make a ticket visible in the Community

                                                                                                    Hi there, It is possible to have a conversation with a customer via a ticket and eventually the proposed solution isn't possible yet. Therefore you want to add it as an idea in the Community, available and open to everyone that is in the community, so
                                                                                                  • When converting a lead to an account, the custom mandatory fields in the account are not treated by zoho as mandatory

                                                                                                    In my Account module I have a number of custom fields that I have set as mandatory. When I enter a new customer as a new account they work, I can't save the record without populating them. However when I convert a lead, my CRM users are able to save the
                                                                                                  • How to Enforce Mandatory Fields (Category/Sub-category) Before Closing a Ticket?

                                                                                                    Hi, I'm currently using Zoho Desk and encountering an issue where agents are able to close tickets without filling out mandatory fields, specifically Category and Sub-category. I’ve already set them both as a mandatory field, but it can still be bypassed
                                                                                                  • Zoho email folders gone

                                                                                                    Hi, All my email folders are gone, i cant found any email, except sent. Also before folder rulesas was changed and i didnt fixed them, could you please check it?
                                                                                                  • Pause/Resume Subscrtiption API

                                                                                                    I don't see the option to Pause/Resume a subscription using the API, is it in the pipeline?
                                                                                                  • Update Department on Ticket (with applied Blueprint)

                                                                                                    Hello, Is it possible to update the Department of a ticket which is dictated by a blueprint, e.g. I would like to change departments at different states in the Blueprint. I do not see this is an option in workflow rules or blueprint transition actions,
                                                                                                  • ERROR_CODE :554, ERROR_CODE :rejected due to spam

                                                                                                    Please verify bounce message: This message was created automatically by mail delivery software. A message that you sent could not be delivered to one or more of its recipients. This is a permanent error. xxx@thalesesec.com Error, ERROR_CODE :554, ERROR_CODE
                                                                                                  • Can't verify domain with AWS Route53

                                                                                                    I have a domain successfully transferred to AWS Route53 from NameCheap. When I try to CNAME or TXT Records as suggested, they are added in AWS console however zohomail does not verify them. For the TXT record zohomail says the value is wrong, whereas
                                                                                                  • Sent emails not going and showing "Processing"

                                                                                                    Hello Team, Could you please assist with sent emails showing "processing" and not actually going through? Many thanks and regards, Cycology
                                                                                                  • LinkedIn verification link and otp not receiving

                                                                                                    For the last 2 to 3 weeks I'm trying to verify my LinkedIn account to access my company's LinkedIn page, Linkedin is sending verification links and codes to this email address but I have not received any codes or links. Please help me here. Looking forward
                                                                                                  • Admin Control for Default Email Templates in Zoho Desk

                                                                                                    Hi Zoho Desk Team, We would like to request a feature enhancement related to default email templates. Currently, agents can select and set their own default email templates when replying to tickets. However, we believe this setting should be managed centrally
                                                                                                  • Unlocking New Horizons: A Year in Review

                                                                                                    As we bid farewell to 2024, let's celebrate and revisit the key highlights of the year. From adding a new edition to cross-platform enhancements, here’s a roundup of all the feature updates designed to simplify accounting, optimize financial management,
                                                                                                  • Zoho desk desktop application

                                                                                                    does zoho desk has a destop applicaion?
                                                                                                  • send file to ftp or another external service

                                                                                                    i'v created a zoho creator application for take a picture and rename it by phone. Now i need to send Each renamed pictures to my ftp or to specific folder on google drive...then, delete it from creator. (every picture recived it will processed by another program and stored on my Erp) HOW CAN I DO ??
                                                                                                  • Error 403: Forbidden When Updating Email Signature via API

                                                                                                    Hi Zoho Desk team, First, congratulations again on the excellent Zoho API. But, I’m encountering an issue while attempting to update an email signature via the API. Whenever I make a request to update the signature, the response returns an HTTP 403 Forbidden
                                                                                                  • 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
                                                                                                  • Mass pdfs into OCR field

                                                                                                    I am working on a Creator app that my org will use internally. Is there any way to mass upload pfs through a form with an OCR file upload field? Is Creator capable of this, or would I need to use Catalyst?
                                                                                                  • How to upload a file to form file upload field from deluge script.

                                                                                                    Hi guys, I need to store API response into Form File upload field . I'm not getting any errors but PDF file is not assigned to file upload field. You can check possibilities using below details: Method: POST URL: https://v2.convertapi.com/convert/web/to/pdf?Secret=<<SecretKey>>&Token=<<APIKey>>&Url=https://www.google.com You need to generate secretKey and APIKey by Login to https://www.convertapi.com/a/su Response: { "ConversionCost": 4, "Files": { "FileName": "www_google_com.pdf", "FileSize": 68342,
                                                                                                  • Export view via deluge.

                                                                                                    Hi, Is it possible to export a view (as a spreadsheet) via deluge? I would like to be able to export a view as a spreadsheet when a user clicks a button. Thanks     
                                                                                                  • Subform Time field showing as null in script.

                                                                                                    Good Afternoon everyone. I am trying to take the information from my subform and populate it into a multiline field in the CRM. The code below works with no errors. The problem is, it shows that the Open and Close (Time fields) are null. But they are
                                                                                                  • Zoho Payroll's Year in Review 2024

                                                                                                    As we roll into 2025, we'd like to pay tribute to all the milestones we hit in 2024! From releasing out new features that streamlined your workflows to updates that made payroll management smoother, we’ve had a prolific year—all while keeping you, our
                                                                                                  • Is there a way to sort report on record template by a specific field like date field

                                                                                                    Hi, Is it possible to sort the report on the record template by the date field and not the default Added Time. Please check the example bellow: The records are sorting by the added time I wand to change that by the date field,
                                                                                                  • Shared subfolders

                                                                                                    Am I right in thinking that there is no Zoho email application that allows me to create a shared inbox and then add additional folders/subfolders under that inbox? If so, this is really quite incredible and probably a deal breaker for us to start using
                                                                                                  • Update Multi select field values to another form table as individual record

                                                                                                    Hi, I am new to coding and do basics within deluge. I need help with the deluge script to meet the following requirement. Form Student Attendance The fields are : Attendance Date Course (Lookup to Course Form) Class (Lookup to Class Form) Students (Multi
                                                                                                  • Shared Mailbox - Mark as read for all users

                                                                                                    Hi all, Maybe someone can help me out. At the moment we have a shared mailbox without streams. When a users reads an mail or marks it as read other users will not see this. How can we resolve this? We now archive the mails when read and followed up. However
                                                                                                  • Allocate emails to user in a shared mailbox

                                                                                                    Hi, This might be obvious, but I cannot find the answer. I have 3 shared mailboxes so any team member can see the emails. Is there a way of allocating a specific email to a user so that it is their responsibility to deal with it? Thanks in advance.
                                                                                                  • How to view shared mailbox in Outlook

                                                                                                    How to view shared mailbox in Outlook or in another software
                                                                                                  • Search mails in shared mailbox

                                                                                                    Hi everyone, is there a way to search mails in shared mailbox's? Search in streams or mail doesn't return anything from mails in shared mailboxes. Thanks! Rafal
                                                                                                  • Customising the approval email

                                                                                                    Is there anyway to customise the Approval email or to add further fields as the default looks so basic and unlike any of the other email notifications from Desk. My users just thought it was spam.
                                                                                                  • Pushing GCLID info from Gravity Forms to ZohoCRM

                                                                                                    We are switching to Gravity Forms from Zoho Forms and I cannot find any good info on how to make sure my GCLID tracking info is pushed through to the CRM through my new forms. There was an article in the documentation about placing something within the
                                                                                                  • Issue Configuring SSO Integration with Cognito in Zoho Help Center

                                                                                                    Dear Zoho Support Team, We have been working on configuring SSO integration for our Zoho Help Center using Amazon Cognito. While the setup appears to be completed successfully, we are encountering an issue when attempting to access the Help Center. The
                                                                                                  • Need manual aggregate column pathing help

                                                                                                    See linked video here: https://workdrive.zohoexternal.com/external/a5bef0f0889c18a02f722e59399979c604ce0660a1caf50b5fdc61d92166b3e7
                                                                                                  • Add blueprint buttons to listview and kanban

                                                                                                    Hello, just started to use the Blueprints feature - really useful. I have one suggestion to help this work even better - can there be transition buttons that appear on the top of listview & Kanban? Maybe an option as well - "Blueprint transitions appear
                                                                                                  • Next Page