Zoho CRM Custom Function For Lead Phone Num Country Code Updation

Recently Zoho CRM Community had a blogpost on how to add country code to Leads along with a script to do the same. But the script seemed to leave a lot to be desired.
Here is a screenshot of their 10-line script:



These are the missing things we noticed with the above script:
1. First, there needs to be validation of whether the incoming phone number is empty or not. In the above script, even if the phone number is empty, '+91' will be added to the phone number. So, this means, in such records, phone number field will have only the value '+91'.
2. It would have been good to make it more generalized than hardcoding a specific country code into the script. Because this script is going to be applied to Leads, it is possible that the Leads may be coming in from various countries, given today's global nature of businesses. So having the script address just one country code is not going to satisfy today's growing business needs.
3. There is no checking in the script to see if the phone/mobile field already has country code in it. Suppose the phone number was already having country code, for example '+91 7788990000', then this script will give the result '+91+91 7788990000', because it doesn't do any checking if the existing phone number already has country code value prefixed with it.

Addressing the above issues, we have attempted our best to write a script which is more generalized, detailed and addresses several corner use cases. You can find it in Github here.



This Custom Function is for the Leads module in Zoho CRM. This code is in Deluge scripting language, which the language used across Zoho suite of products.  This is used to check an incoming lead to see if their phone num has the country dialing code. If not, then this code would fetch the appropriate code based on the'Country' field value from the Lead. 

Comments

Popular Posts