You need to sign in to do that
Don't have an account?
SUMAN KUMARI 70
Display the phone numbers in three-digit format
Hi All,
I have a requirement to display my phone number on my visualforce page in three- digit format. This format change will only be done when there are only three digits preceded with zeros or three digits appended with zeros.
Example: Instead of 000-000-0711 or 711-000-0000, number will be displayed as 711.
Thank you so much for you help in advance.
I have a requirement to display my phone number on my visualforce page in three- digit format. This format change will only be done when there are only three digits preceded with zeros or three digits appended with zeros.
Example: Instead of 000-000-0711 or 711-000-0000, number will be displayed as 711.
Thank you so much for you help in advance.
I don't think there is an out of the box solution for the use case, I found this article regarding the possible standard ways: https://help.salesforce.com/articleView?id=000330422&language=en_US&type=1&mode=1. I think for your use case you might have to implement a custom solution.
You could additionally try checking https://help.salesforce.com/articleView?id=basics_understanding_values_curr_date_phone.htm&type=5 as mentioned in the above help article.
Do let me know if this helps.
Regards,
Anutej
Actually I already have a visualforce page which is diplaying the Phn number. It's just that I have to change the format of the phone number such that if there are only three digits preceded with zeros or three digits appended with zeros then only the three digits should be displayed omiting the 0's.
Example: Instead of 000-000-0711 or 711-000-0000, number will be displayed as 711.
I have found a solution for this but don't know how to execute it.
I can create a javascript function which will take a input as a string and will check if it is satifying these 2 conditions and if yes then it will trim the string and will return the value and if not then will simply return the prior value.
Kindly help me wrinting the if conditon to check these 2 conditions.
Thanks.
>> https://stackoverflow.com/questions/24295121/remove-leading-and-trailing-zeros-from-a-string
var repl = str.replace(/^0+(\d)|(\d)0+$/gm, '$1$2');