What's up with Phone Numbers in Salesforce?

What's up with Phone Numbers in Salesforce?

Here’s a quick OCD test for you: does anything bug you about the Phone column in the sample data below?

No alt text provided for this image

Take a look at the number for Edward Stamos. No parentheses around the area code. Same for Jon Amos, and he has periods in his number.

While this may be an aesthetic irritant for some of us, this could actually hinder some apps that make use of phone numbers, such as a phone dialer or SMS texting app. So what’s going on here?

Phone number fields in Salesforce are special because they store data without formatting, but may display it in the local formatting for phone numbers. According to their documentation...

When you enter phone numbers in various phone fields, Salesforce preserves whatever phone number format you enter. However, if your Locale is set to English (United States) or English (Canada), 10-digit phone numbers and 11-digit numbers that start with “1” are formatted as (800) 555-1212 when you save the record.

That means, if you enter 1234567890 and save, the number will display as (123) 456-7890. However, if you enter 123 456-7890, or any permutation that includes non-digits such as a period, a dash, a plus sign, or a parenthesis, the automatic formatting does not work. It gets saved as a string of characters rather than a phone number. Same thing if you add x123 at the end.

If you enter (123) 456-7890, this will display exactly as if you had entered 1234567890, but it’s actually different data. The difference is that apps looking for a phone number may not recognize that first entry with the parentheses, the space, and the dash.

When I was creating Proton Text, an SMS texting app for Salesforce, I added code to clean numbers with extraneous characters. The code uses a simple REGEX filter to strip out all non-digit characters. I recognized that virtually every user will be entering phone numbers at one time or another, so it’s unreasonable to rely on good data entry habits. Better to let the code do it. Note that I don't actually change the data that is saved, but I clean it before trying to use it.

So, what happens if you have thousands of records with inconsistent phone number data? (This is especially likely if you have imported lists of Leads with phone number fields.) If it’s just a cosmetic nuisance, I’d live with it. But if you have an app that can’t handle it, you have two tasks: 1) fix old records with an Apex method that finds dirty numbers and cleans them, and 2) implement a workflow or validation rule that assures only clean data goes in for new records. 

Shameless Plug for Proton Text

If you learned something here, please take a moment to check out my app on the AppExchange. Proton Text is a very affordable solution for sending and receiving SMS and MMS texts from within Salesforce. It's great for 1-to-1 messaging, automated texts like appointment reminders, and for bulk SMS blasts (that's the "Proton Blaster" feature). Let me know if you'd like a live demo.

No alt text provided for this image


Eric Hanshew

Minimizing taxes

5 年

I made a study of this several years ago and could not locate any standard numbering system for listing a domestic phone number. (###) ###-####; ###-###-####; ###.###.####; and ### ### #### all being valid. How do you deal with ( ) - . and blank spaces? Canada uses the dash as a standard but the US is all over the place. And you are absolutely correct that the system utilized either enables or disables automatic dialing features with technology like smartphones. Happens to me all the time. I'm a fan of parentheses myself but the dash being the international standard for listing phone numbers would be more sensible. It's kinda like how the US has adapted the metric system ;-) We need a champion to create a uniform system like Theodore Roosevelt did in his efforts to standardize spelling here in the states. Boy, I sure do sound like a nerd!

回复

要查看或添加评论,请登录

Pat McClellan的更多文章

  • The Case for Auto-Layout

    The Case for Auto-Layout

    Salesforce is investing big in the ever-expanding capability of Flow Builder. One major change in the past year has…

    26 条评论
  • The Training and Education Fund: a Proton Profile

    The Training and Education Fund: a Proton Profile

    The healthcare workforce is under tremendous stress, resulting from an aging population, a shortage of trained workers,…

  • That time I met a Salesforce MVP

    That time I met a Salesforce MVP

    Like many in the Salesforce Ohana, I'm a career-changer who found myself swirling in a rapidly growing ecosystem…

    5 条评论
  • A personal perspective on the quarantine timeline.

    A personal perspective on the quarantine timeline.

    If you listen to political leaders, they are optimistic that we’re almost through the days of stay-at-home; won’t be…

  • Proton Toaster is here!

    Proton Toaster is here!

    Sometimes you need to get your users' attention fast, no matter what page they're on. You could send a custom…

    8 条评论
  • The Joys of Flows

    The Joys of Flows

    I built an app called Proton Text that allows users to send and receive text messages from within Salesforce; it's…

    11 条评论
  • 2 Quick URL Tricks in Salesforce

    2 Quick URL Tricks in Salesforce

    Shortcut to the Pinned List View Every Salesforce record has an 18 character Id, and the first three characters are the…

    2 条评论
  • A Quick Primer on SMS Texting in Salesforce

    A Quick Primer on SMS Texting in Salesforce

    When you think about texting from Salesforce, think of these three categories: 1-to-1 messaging, automated SMS, and…

    5 条评论
  • Missed Appointments Cost Home Industry Millions

    Missed Appointments Cost Home Industry Millions

    Cut No-Show Costs and Increase CSAT with automated SMS Appointment Reminders It has probably happened to you this week…

  • 'Follow your Bliss?' How about 'work your ass off', instead?

    'Follow your Bliss?' How about 'work your ass off', instead?

    It's become a cliché in everyday life, and especially on work-related sites like this one. You see the stories and hear…

    8 条评论

社区洞察

其他会员也浏览了