Add the international call prefix

Standardize lead phone numbers by adding an international call prefix (+), removing letters and special characters, and updating the lead record with the formatted number.

When you generate leads through webforms, imports, or third-party integrations, phone numbers often arrive in inconsistent formats—without an international call prefix, or containing letters, parentheses, dashes, spaces, or other non-numeric characters. For example, a phone number may be entered as 91-98765 43210 or 919876543210 Ext. These inconsistencies can lead to significant operational issues, such as difficulty detecting duplicate entries when the same number appears in different formats, and telephony integrations or SMS platforms rejecting non-standardized numbers. In addition, searching and filtering within the Leads module can become unreliable.

Manually cleaning up these phone numbers in your lead database can be both time-consuming and burdensome. What if you could standardize them automatically without any manual intervention? Fortunately, there's a simple way to streamline this process.

By using a client script along with a workflow rule, you can automatically strip all non-numeric characters and add the international dialing prefix ("+") whenever a lead is created or edited in your CRM. This way, you can ensure that every phone number is stored in a clean, standardized format, which improves data hygiene and full compatibility with downstream systems such as dialers and SMS gateways. Read on to learn more.

Permissions and availability

  • Users with the Manage Automation permission can create and update workflow rules.
  • Users with the Manage Extensibility permission can create custom functions.
  • Users with the Manage Sandbox permission can manage the sandbox.

Requirements

  • Create a workflow rule for the Leads module that triggers every time a lead is created or edited in your CRM. Learn more
  • Write a custom Deluge function to standardize lead phone numbers and link it to the workflow rule. Learn more
  • Test the workflow rule in a sandbox before deploying it in your production environment. Learn more

Create a workflow rule

Follow the steps below to create a workflow rule in your Zoho CRM account:

  1. Navigate to Setup > Workflow Rules and click + Create Rule.
  2. Select Leads from the module dropdown list.
  3. Provide a name for the rule. For example: "Standardize phone number format".
  4. Add a description, if required, then click Next.
  5. In the Execute this workflow rule based on section, do the following:
    1. Choose Record Action, then select Create or Edit from the dropdown.
    2. Check the box for Repeat this workflow whenever a lead is edited option.
    3. Click Next.
  6. In the Which Leads would you like to apply the rule to? section, specify the condition as "<Phone> <is not empty>", then click Next.
  7. Under Instant Actions, select Function and Write your own.
  8. Provide a name for the function, as well as a description, if necessary.
  9. In the Deluge script editor, do the following:
    1. Copy and paste the code provided below.
    2. Click Edit Arguments.
    3. Choose Leads - Lead Id, then name it leadId.
    4. Click the + icon to add more arguments.
    5. Choose Leads - Phone, name it phone, and click Save.
    6. Click Save & Execute Script.
  10. Click Save on the workflow rule page.

The code

Code Copied
alphanumeric = input.phone.getAlphaNumeric();
numeric = alphanumeric.removeAllAlpha();
info numeric;
number = "+" + numeric;
mp = Map();
mp.put("Phone",number);
update = zoho.crm.v8.updateRecord("Leads",leadId.toLong(),mp);
info mp;
info update;

Notes

  • Make sure to use the accurate API names (e.g., "Phone") for their corresponding fields in the code snippet. Learn more.
  • The above script is an example of standardizing lead phone numbers by stripping all non-numeric characters (including letters, parentheses, dashes, spaces, and special symbols) and prepending a + sign. You can use this code for any other module (such as Contacts) or any other field (such as Mobile) by modifying the module name and parameters.

Tip

  • Configure and test the solution in a sandbox to ensure that further development doesn't disrupt your production environment.

Test the solution

  1. Navigate to Leads > + Create Lead.
  2. On the Lead Details page, enter the lead information and a phone number with mixed characters (e.g., 1-800-555-1234), then click Save.
    The workflow rule will be triggered.
  3. Refresh the page and check whether the Phone field has been updated to the standardized format with the + prefix:
    • 1-800-555-1234 → +18005551234
  4. Edit an existing lead record and check the flow above to confirm the Phone field is cleaned and updated with the + prefix.
  5. Test edge cases by creating leads with an empty Phone field and a phone number already in the correct format.

Did you find this useful? Try it out and let us know how it works. Share this with your team if they'd benefit from it! If you have questions, please don't hesitate to contact us.

More info

  • ModuleLeads
  • Trigger PointWorkflow Rule
  • EditionEnterprise and above
  • ComplexityLow
  • Implementation Time15 minutes

Features used in the solution

Workflow RuleDeluge ScriptSandbox
Story Image

Looking for a custom solution?

Contact us, we will help enhance your productivity at lightning speed.

SUBMIT REQUEST

Developers: Share your solution with our community!