function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mahesh Babu 3Mahesh Babu 3 

Phone format to display on vf page

Hi All,

I am trying to display the account phone on vf page in this standard phone format (xxx) xxx-xxxx
Format has displayed in required format if user inserted the account record by manual
Format has not displayed in required format if account records inserted by using any import wizards/ apex code / data loader, (displayed in normal format like xxxxxxxxxx)

Please guide me how to resolve this issue

 
kiranmutturukiranmutturu
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), ten-digit phone numbers and eleven-digit numbers that start with “1” are automatically formatted as (800) 555-1212 when you save the record....Also note that this can only be done via User Interface and NOT via the API.
Mahesh Babu 3Mahesh Babu 3
Thanks for replay Kiran

Is any workaround to achieve this? if records are inserted via API (dataloader, apex, import wizard)
kiranmutturukiranmutturu
until you edit from the UI it won't change the format to standard. If you want on insert with the format the only way is set the data in the CSV in the standard format as phone is a text field it will accept the format I hope so. And there is an idea for this you can promte this also https://success.salesforce.com/ideaView?id=08730000000hE5jAAE
Mahesh Babu 3Mahesh Babu 3
For data format, we have this solution 

<apex:outputText value="The formatted time right now is: {0,date,yyyy.MM.dd G 'at' HH:mm:ss z}">        
      <apex:param value="{!NOW()}" />
</apex:outputText>

Is any solution for phone number format? as like above date fomat