Skip to content

How to format phone numbers in Salesforce with a flow

Salesforce only formats phone numbers for users with a US or Canadian locale, so UK numbers are saved as typed. A before-save record-triggered flow (Fast Field Updates) can strip spaces, brackets and dashes and turn a number typed as 07xxx xxxxxx into +447xxxxxxxxx before the record is saved.

By CobyLast reviewed

Phone numbers in Salesforce end up in many shapes: 07xxx xxxxxx, (020) xxxx xxxx, +44 (0)20 xxxx xxxx, 0044 20 xxxx xxxx (with x standing for the digits). They are the same kind of number written different ways, and that makes them hard to search, match and dial from other systems. A record-triggered flow can tidy each number into one format as the record is saved, whether it was typed by a user, loaded in an import or sent by an integration.

Checked on 4 December 2026 against Salesforce Help, Trailhead, the Salesforce Admins blog, the Formulas Quick Reference, the Apex Developer Guide and the object reference. Menu labels can move between releases. If you have no admin to build and test this, our fractional Salesforce admin service covers jobs like this one.

Why Salesforce does not tidy UK numbers for you

Salesforce formats phone numbers itself only for some users. Salesforce Help says "Salesforce preserves whichever phone number format you enter", and gives its automatic formatting as exceptions for users whose User Locale is "English (United States)" or "English (Canada)". A team with UK locales gets whatever each person typed.

Salesforce’s own phone formatting, from Salesforce Help

What is enteredWhat Salesforce does
Any number, user locale not English (United States) or English (Canada)Saved as entered
10 digits, US or Canadian localeSaved in parenthesis format, such as (123) 456-7890
11 digits starting with 1, US or Canadian localeThe leading 1 is dropped and the number is saved as 10 digits
A 10 or 11 digit number typed with + in front, US or Canadian localeKept in the format typed
A number on a record created from Web-to-LeadNot auto-formatted
A number entered in Salesforce for iOS and AndroidNot auto-formatted
Salesforce Help, "Standard Phone Field Length and Automatic Formatting Rules in Salesforce CRM", checked 4 December 2026.

The API behaves the same way. The SOAP API Developer Guide says phone fields can include alphabetic characters and that "Client applications are responsible for phone number formatting." So an import tool or integration writes the number exactly as it sends it. Salesforce Help also says phone fields accept a maximum of 40 digits when entered through the Salesforce UI, and that this limit does not apply to numbers entered through the API.

Choose a format before you build

Decide what a tidy number looks like in your org. Our advice for a UK business is to store every number as +44 followed by the number without its leading 0 and with no spaces, for example +4420xxxxxxxx for a number written (020) xxxx xxxx and +447xxxxxxxxx for one written 07xxx xxxxxx. Two reasons: Salesforce Help says typing + before a 10 or 11 digit number keeps the format you typed, so a user with a US or Canadian locale does not get it reformatted; and one fixed shape is easy to check with a validation rule. Salesforce’s own sample formula for a contact’s phone country code gives 44 for the UK.

The leading 0 is the part people write in different ways. GOV.UK’s contact page for HM Passport Office, for example, gives its number in the UK form starting 0300 and, for callers from outside the UK, the same number with +44 in front and the 0 in brackets, starting +44 (0)300. Our flow drops that bracketed 0 when it adds +44.

Flow or validation rule: which to use

There are two ways to get one format. A flow changes the number for the user as the record is saved. A validation rule leaves the number alone and stops the save with an error until someone fixes it: Trailhead says validation rules "verify that data entered by users in records meets the standards you specify before they can save it." Each suits different data.

Before-save flow or validation rule for phone formats

QuestionBefore-save flowValidation rule
What happens to an untidy numberChanged to your format as the record savesThe save is stopped with an error message
Who fixes itNobody: the flow doesThe person or system that entered it
Data from forms, imports and integrationsTidied as it arrivesRejected, so the import row or integration call fails
Numbers the rules do not recogniseLeft as entered, so they can slip throughBlocked until someone corrects them
Better whenData arrives from many places and you want it fixed without fussA person should check the number, or an import should fail rather than be changed
Our comparison, based on Trailhead’s validation rules unit and the Apex Developer Guide’s order of execution, checked 4 December 2026.

A validation rule is the better choice when the person typing is the only one who knows the right number, for example a support agent on a call, or when you would rather an import fails than have its data changed. A flow is the better choice when numbers come from web forms, imports and integrations that nobody can correct one by one.

You can use both. The Apex Developer Guide’s order of execution runs record-triggered flows that are configured to run before the record is saved, then before triggers, then custom validation rules, then duplicate rules. So the flow tidies the number first and a validation rule only sees what the flow could not fix. Duplicate rules then see the tidied number too.

Step 1: create the flow

Build it in a sandbox first if you have one. Trailhead’s steps for a new record-triggered flow:

  • From the App Launcher, search for "auto" and select Automation, then click New in the Flows panel and choose Record-Triggered Flow.
  • Set the object, for example Contact, and set the trigger to A record is created or updated.
  • Set Optimize the Flow For to Fast Field Updates.

Fast Field Updates is the before-save option. Trailhead says it runs before the triggering update is saved and lists "Updating the record that triggered the transaction" among its uses. The Salesforce Admins blog says these flows are faster and less likely to hit database limits, and that a flow can use them if its Update Records elements update only the triggering record and it has no Create Records, Action, Delete Records or Subflow elements. A flow that only tidies a phone number on the same record meets both conditions.

Set an entry condition so the flow runs only when it has work to do. The Admins blog shows ISNEW() and ISCHANGED() in record-triggered flow formulas: ISNEW() is true when the record is new, and ISCHANGED() is true when a field’s value differs from its previous value. Choose a formula as the condition requirement and use:

Our advice is one phone flow per object, covering every phone field you care about on it. The object reference lists Phone (label Business Phone) and MobilePhone on Contact, Phone and MobilePhone on Lead, and Phone on Account. For each extra field, add it to the entry condition with another ISCHANGED() and repeat steps 2 and 3 for it.

Step 2: two formula resources

The work is done by two Text formula resources. The functions come from Salesforce’s Formulas Quick Reference: SUBSTITUTE replaces old text with new text, BEGINS checks whether text begins with given characters, LEN returns the number of characters, and RIGHT returns a number of characters from the end of a text string.

The first, StrippedPhone, removes spaces, brackets, dashes and full stops:

The second, FormattedPhone, adds +44 where it is safe to and leaves anything else alone:

The order of the checks matters: +44 with a bracketed 0 is handled before any other + number, and 0044 before other numbers starting 00. Numbers that start 00 with another country code, or with no 0 or + at all, are stripped of spaces and brackets but otherwise left as they are, so the flow never guesses a country.

What the two formulas do to some example entries

EnteredSaved as
07xxx xxxxxx+447xxxxxxxxx
(020) xxxx xxxx+4420xxxxxxxx
+44 (0)20 xxxx xxxx+4420xxxxxxxx
0044 20 xxxx xxxx+4420xxxxxxxx
+33 1 xx xx xx xx+331xxxxxxxx
0033 1 xx xx xx xx00331xxxxxxxx (left for a person to check)
x stands for any digit. Worked from the formulas above. Test them in your own org before you rely on them.

The flow does not check that a number has the right number of digits. That is a job for a validation rule, or for a person reviewing a report of numbers that do not start with +.

Step 3: assign the result and test it

Add an Assignment element after the Start element and set {!$Record.Phone} Equals {!FormattedPhone}. The Admins blog says that in a Fast Field Updates flow you can assign values to fields in the $Record variable, the triggering record, and those values are saved with the triggering change, so no Update Records element is needed.

Save the flow and click Debug. Trailhead’s debug steps for a record-triggered flow are to select Skip start condition requirements, choose whether to run the flow as if the record is created or updated, pick a record and click Run. A successful run shows the connecting lines in dark blue. Try each of the example entries in the table above, then activate the flow.

The flow only acts when a record is created or its phone number changes, so the numbers already in your org stay as they are. To tidy them, we would export the records, apply the same rules in the export, and update them back, in a sandbox first. Our guide to Salesforce data migration covers the export and load steps.

Adding a validation rule as a backstop

Salesforce’s sample validation rules include "Phone Number Has International Format", which checks that the phone number begins with a plus sign: LEFT(Phone, 1) <> "+", with the error message "Phone number must begin with + (country code)." Trailhead says a validation rule that returns true means the data contains an invalid value, so this rule blocks any number that does not start with +.

With the flow in place, this rule only catches what the flow left alone, such as a 00 number with another country code. We would add NOT(ISBLANK(Phone)) && in front of the sample formula, so a record with no phone number can still be saved. Salesforce’s samples also include a US rule that checks for ten digits in the (999) 999-9999 format, and say the international rule conflicts with it, so use one or the other. If imports must never fail, leave the validation rule out and report on numbers that do not start with + instead.

Untidy phone numbers are one of the ways CRM data drifts over time. Our post on why CRM data gets worse over time covers the wider problem.

Getting help with Salesforce automation

Black Cloud is a UK Salesforce partner that works only on Salesforce, across the UK and Ireland. Our fractional Salesforce admin service gives you part of a senior admin’s time each month for jobs like this flow. Our managed service packages start at £950 a month for 5 hours, excluding VAT. See how we work or get in touch.

Sources

  1. Salesforce Help, "Standard Phone Field Length and Automatic Formatting Rules in Salesforce CRM" (checked 4 December 2026)
  2. SOAP API Developer Guide, "Field Types" (checked 4 December 2026)
  3. Trailhead, "Get Started with Triggered Flows" (checked 4 December 2026)
  4. Trailhead, "Build a Record-Triggered Flow" (checked 4 December 2026)
  5. Salesforce Admins blog, "Automate This: Discover Tips and Best Practices for Record-Triggered Flows" (checked 4 December 2026)
  6. Salesforce Admins blog, "What Is a Record-Triggered Flow?" (checked 4 December 2026)
  7. Salesforce Admins blog, "Three Powerful Formula Functions You Can Use in Flow" (checked 4 December 2026)
  8. Salesforce, "Formulas Quick Reference" (checked 4 December 2026)
  9. Salesforce, "Sample Contact Validation Rules" (checked 4 December 2026)
  10. Salesforce, "Sample Contact Management Formulas" (checked 4 December 2026)
  11. Apex Developer Guide, "Triggers and Order of Execution" (checked 4 December 2026)
  12. Trailhead, "Create Validation Rules" (checked 4 December 2026)
  13. Object Reference, "Contact" (checked 4 December 2026)
  14. Object Reference, "Lead" (checked 4 December 2026)
  15. Object Reference, "Account" (checked 4 December 2026)
  16. GOV.UK, "Passport advice and complaints" (HM Passport Office contact) (checked 4 December 2026)

Questions

Common questions.

Does Salesforce format UK phone numbers automatically?

No. Salesforce Help says Salesforce preserves whichever phone number format you enter, and gives its automatic formatting as exceptions for users whose User Locale is English (United States) or English (Canada). A UK locale is not one of them.

Should I use a flow or a validation rule to format phone numbers?

Use a flow when numbers arrive from forms, imports and integrations and you want them tidied without anyone stepping in. Use a validation rule when the person entering the number should correct it, or when an import should fail rather than be changed. Many orgs use both, with the validation rule catching what the flow cannot fix.

Why use Fast Field Updates rather than Actions and Related Records?

Because the flow only changes the record that triggered it. Trailhead says Fast Field Updates runs before the record is saved and is for updating the triggering record, and the Salesforce Admins blog says these flows are faster and less likely to hit database limits.

Will the flow change phone numbers already in Salesforce?

No, not on its own. With the entry condition in this guide, it runs only when a record is created or its phone number changes, so existing numbers need a one-off clean-up, for example an export and update.

Does the flow run before my validation rules?

Yes. The Apex Developer Guide’s order of execution runs record-triggered flows configured to run before save first, then before triggers, then custom validation rules and then duplicate rules, so those rules see the tidied number.

Related

Next step · Salesforce admin cover

A Salesforce admin, by the month.

Our monthly packages cover the day-to-day running of your org, whether you have no admin or one who needs backup.