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
Zach AckermanZach Ackerman 

Data.com Formating Trigger

I am trying to properly format the data.com phone entry. I want the update to format the number as (555) 555-1212 when the user editing is autocln. I think I am partially therre, but missing something. 

    {
    // Fix Phone Number Formating +1.555.555.1212 to (555) 555-1212
        if((lead.Phone.startsWith('+1.')) && (l$User.Alias == "autocln"))
            {
            lead.Phone = lead.Phone.substring(3);
            lead.Phone = lead.Phone.replace('.', '-');
            lead.Phone = lead.Phone.replaceFirst('(^[0-9][0-9][0-9]).','($1) ');
            }
        //lead.Phone = lead.Phone.replace('.', '-');
        }
    }