10

I would like to include line breaks within a Validation Rule Error Message without the use of Visual Force. Is this possible?

2 Answers 2

4

If I remember correctly you can embed HTML into error messages that you create from code. I am not sure if the text box for the validation rule will allow you to put HTML into it and that be rendered correctly but I have created custom validation rules by checking a condition and calling the Sobject.addError(errorMessage) onto an object if the condition is met. You can embed HTML into these error message as I have seen it used to link to a visualforce page with a much more thorough description of the error. Creating the error message this way should allow for linebreaks to be embedded since they allow for HTML rendering.

2
  • 3
    Watch out. There is a critical update that will auto activate in Feb that could impact code. To continue to pass html through you need to do Sobject.addError(errorMessage, false) Nov 9, 2013 at 5:22
  • 1
    I know. I am pretty depressed about it.
    – Chris
    Dec 12, 2013 at 14:55
4

It is not possible to include any formatting or line breaks in a standard validation rule. I tried various permutations such as including
or \n just to make sure.

You must log in to answer this question.

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