Noltic Has Created the Library for Parsing and Validating International Phone Numbers in Salesforce
This a port of Google's library that has been used by Android Framework since 4.0 (Ice Cream Sandwich) and is also packaged by individual apps in order to stay up to date with fresh metadata (e.g. valid number blocks) and APIs. Such apps include Allo, Duo, Hangouts, Messenger, and YouTube Go. It’s also used across platforms for Chrome, Click-to-call ads, Gmail, Google account creation, Maps and more.
Noltic came up with the idea when one of its clients wanted to use one library across all their technology stack on the project, but it wasn’t available on Salesforce. Noltic ported the famous Google library and adapted it to the Salesforce best practices.
Libphonenumber has been used by Android Framework since 4.0 (Ice Cream Sandwich), and it is also packaged by individual apps in order to stay up to date with fresh metadata (e.g. valid number blocks). The apps that use libphonenumber include Allo, Duo, Hangouts, Messenger, and YouTube Go. It’s also used across platforms for Chrome, Click-to-call ads, Gmail, Google account creation, Maps and more.
Features & functionality:
- Parsing, formatting, and validating phone numbers for all countries/regions of the world.
- Gets the type of the number based on the number itself; able to distinguish Fixed-line, Mobile, Toll-free, Premium Rate, Shared Cost, VoIP, Personal Numbers, UAN, Pager, and Voicemail (whenever feasible).
- Gets a confidence level on whether two numbers could be the same.
- Provide valid example numbers for all countries/regions, with the option of specifying which type of example phone number is needed.
- Quickly guesses whether a number is a possible phone number by using only the length information, much faster than a full validation.
- Full validation of a phone number for a region using length and prefix information.
- Formats phone numbers on-the-fly when users enter each digit.
- Finds numbers in the text.
- Provides geographical information related to a phone number.
- Provides carrier information related to a phone number.
- Provides timezone information related to a phone number.
“We had to adapt to a lot of Salesforce specifics when porting this library - storing the data in the required format, parsing and validating phone numbers and adjusting the code and tests to adhere with limits of Salesforce,” says Pavlo Moroz, Salesforce Architect at Noltic.
The library will be maintained based on releases of the Google library. The company will port any further updates or bug fixes and update the library with useful Salesforce specific features based on the requests from our clients. It means that anyone can use our solution for their long term projects with confidence.
Noltic is a consulting and development agency that offers a full cycle of Salesforce services - from ideation to a viable solution. Since 2017, the company has been designing, building, implementing, and supporting Salesforce solutions for startups, medium businesses, and large enterprises.