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
vicky30vicky30 

Update phone number in Brazil country format

Hi friends, 
I need solution on this requirement.  The requirement is to update the phone number on Brazil format ex: (99) 99999999. When user create or update a phone the number should be save on this format.  I tried using workflow rule with field update,  but it's not working. Is there any solution using trigger.  I need a logic for this requirement. 
Waiting for the solution. 
Thanks in advance... 
@Amit Kumar Giri@Amit Kumar Giri
The REGEX for Brazil phone format is   !REGEX(Phone,"^((\\+\\d{2}\\s)?\\(\\d{2}\\)\\s?\\d{4}\\d?\\-\\d{4})?$")
But if u need to convert then u need to write custom formula . Check the below link there are few answers and u need to modify a bit. This is giving format of (xxx) xxx-xxxx
https://developer.salesforce.com/forums/?id=906F00000009FN3IAM
vicky30vicky30
Hi Amit,
I did all these thing but no result. I created a workflow rule with field update
I used this formula '('+MID(ZTS_EU_Main_Phone__c , 1, 2)+')'+MID(ZTS_EU_Main_Phone__c,3,LEN(ZTS_EU_Main_Phone__c))
But its not working. Is there any logic using triggers