Hello there,
Every now and then, we need to search for customers by phone number. However, due to inconsistent data entry across multiple applications, searching for phone numbers is very difficult/impossible. For example, phone numbers in the USA can be written as:
+1 (123) 456-7890
+1 (123) 4567890
+1 123-456-7890
+1 123 456 7890
+11234567890
And then of course it can be written all those ways but without a country code (+1) in the beginning.
Depending on how a user searches for a phone number, Zoho Subscriptions may or may not return a matching result, because even if all the NUMBERS are correct, the FORMAT seems to be the problem.
I was wondering if you could adjust the search mechanics so that formatting and country codes aren't taken into account. For example...
numberToSearch = userInput.replaceAll("[^0-9]","");
numberToSearch = numberToSearch.right(10); // Removes the (+1) country code, if present
// Then search database:
MatchingCustomer = CustomerPhone.replaceAll("[^0-9]","").contains(numberToSearch) || CustomerMobile.replaceAll("[^0-9]","").contains(numberToSearch);
I would create a custom function myself, but I don't know how to make Line 4 work. I don't think it's possible for us to search matches on "altered" forms of stored values, without iterating through every phone number in our database and creating a Map() from scratch. But that would easily exceed our maximum allowable # of arguments per function as we have thousands of customers.
I'm hoping perhaps you can implement this search method on your end, or provide us a way to code this ourselves.
Thank you,
Josh