I have a formula field that creates an email address for me, but when there's an extra space after someone's last name it returns an extra "." and breaks my automation connection to create the email.
Ex. sandy.castellano. --- it should be sandy.castellano
I thought adding TRIM to the last name would fix the issue but I keep getting an error code. Can anyone help with removing extra spaces in the last name?
Current Code:
SUBSTITUTE ( SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
( REGEX_REPLACE ( REGEX_REPLACE ( REGEX_REPLACE ( LOWER ( REGEX_REPLACE ( REGEX_REPLACE ( REGEX_REPLACE ( first_name & " " & last_name , "," , " " ), "'" , "" ), " " , " " )), " " , "." ), "\\.\\." , "." ), '-' , '.' )),
"á" , "a" ),
"à" , "a" ),
"â" , "a" ),
"å" , "a" ),
"æ" , "ae" ),
"ç" , "c" ),
"è" , "e" ),
"é" , "e" ),
"ë" , "e" ),
"ê" , "e" ),
"î" , "i" ),
"ï" , "i" ),
"ì" , "i" ),
"ñ" , "n" ),
"ô" , "o" ),
"ö" , "o" ),
"ò" , "o" ),
"ø" , "o" ),
"õ" , "o" ),
"ù" , "u" ),
"û" , "u" ),
"ü" , "u" ),
"ý" , "y" ),
"í" , "i" ),
"ú" , "u" ),
"ş" , "s" ),
"ó" , "o" )
Best answer by courtneydean
I was able to figure it out with the help of Collen w/ Airtable Support!
Had to convert the look up field to a text string.
SUBSTITUTE ( SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (
SUBSTITUTE (( REGEX_REPLACE ( REGEX_REPLACE ( REGEX_REPLACE ( LOWER ( REGEX_REPLACE ( REGEX_REPLACE ( REGEX_REPLACE ( first_name & " " & TRIM ( ARRAYJOIN ( last_name )), "," , " " ), "'" , "" ), " " , " " )), " " , "." ), "\\.\\." , "." ), '-' , '.' )),
"á" , "a" ),
"à" , "a" ),
"â" , "a" ),
"å" , "a" ),
"æ" , "ae" ),
"ç" , "c" ),
"è" , "e" ),
"é" , "e" ),
"ë" , "e" ),
"ê" , "e" ),
"î" , "i" ),
"ï" , "i" ),
"ì" , "i" ),
"ñ" , "n" ),
"ô" , "o" ),
"ö" , "o" ),
"ò" , "o" ),
"ø" , "o" ),
"õ" , "o" ),
"ù" , "u" ),
"û" , "u" ),
"ü" , "u" ),
"ý" , "y" ),
"í" , "i" ),
"ú" , "u" ),
"ş" , "s" ),
"ó" , "o" )