You need to sign in to do that
Don't have an account?

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('.', '-');
}
}
{
// 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('.', '-');
}
}