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
ecastilloecastillo 

Remove white spaces between two words in formula

We currently have a workflow that creates a "dummy" email address when an email address is not provided in a lead or contact record. The business requirement is for the email address to be FirstName.LastName@Company.nomail. The problem we're running into is that the email fields do not like any spaces in the email address, which is a problem for company's with multiple words in their name.. i.e. Some Burger Corp. Contact names also cause the same issue.

 

The workflow uses a simple formula to set the value: FirstName +"."+ LastName +"@"+ Company +"."+ "nomail"


Is there a way to remove all white spaces in a concatenation formula?

 

Thanks for you help.

Best Answer chosen by Admin (Salesforce Developers) 
Boom B OpFocusBoom B OpFocus

Change your formula to this"

 

SUBSTITUTE(FirstName , " ", "")+"."+ SUBSTITUTE(LastName , " ", "")+"@"+ SUBSTITUTE(Company , " ", "") +"."+ "nomail"

 

This will replace a space with no space.

All Answers

Deepa.B.AnkaliDeepa.B.Ankali
@ecastillo,

Use formula function, "TRIM()"
Boom B OpFocusBoom B OpFocus

Change your formula to this"

 

SUBSTITUTE(FirstName , " ", "")+"."+ SUBSTITUTE(LastName , " ", "")+"@"+ SUBSTITUTE(Company , " ", "") +"."+ "nomail"

 

This will replace a space with no space.

This was selected as the best answer
ecastilloecastillo

Thanks Boom B... that worked great.

 

@DeepaAnika.Ankali Thanks for the reply. I had originally tried the TRIM() but it will only delete extra white spaces and not all white spaces, unless I did a character count, which in this case would not be possible.