I have a URLName text field that needs to copy another text field with the following format

Title text field : A New Article

URLName text field : A-New-Article

Basically spaces are replaced by dashes.

So far I have created a formula that does exactly that

SUBSTITUTE( {!Title} , " ", "-")

replacing all the spaces with a dash

The problem I have is that sometimes users wants to write a more descriptive title with special characters. But when doing so, I have an error. Let's say I write the following in the Title field

Text field Title : A New Article was created / Account #5: Id.231

I get an error as the URL field does not accept special characters (e.g. , / : ; ! " * ...etc)

FIELD_INTEGRITY_EXCEPTION: Invalid URL name. The URL name can include only unicode characters and hyphens, and it can't begin or end with a hyphen.: URL Name.

Is there a way to create a formula to ignore all special characters and at the same time replace spaces with dashed to be left only with a format with dashed

So for example

Text field Title : A New Article was created / Account #5: Id.231

URLName field: A-New-Article-was-created-Account-5-Id231


1 Answer 1


Formula is not as robust as the likes of Apex to convert/substitute the special characters. For your above example, a static formula can be built using a nested SUBSTITUTE approach such as

                SUBSTITUTE(Title , " / ", " ")," ", "-"), " #" , ""), ": " , " "), "." , "")

Moving to Apex, you can use Patterns and Matchers.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .