I have one field with long text area datatype with limit 1000. During the input, I am using JEasyCounter to validate 1000 character. The user insert 1000 character including new line (Of course creating new line is not counted as character) and it prompt this error.

Upsert failed. First exception on row 0 with id aKMn0000000000asGAA; first error: STRING_TOO_LONG

I notice it read somewhere in the error description. However when I remove new line, just type 1000 character then it will be saved successfully.

How should I handle this?

1 Answer 1


From the documentation of the Text Area (long):

Note that every time you press Enter within a long text area field, a linebreak and a return character are added to the text. These two characters count toward the 131,072 character limit.

So you should somehow cut out these characters: \rand \n

  • can it be done in javascript side?i m not sure jeasycounter able to catch this.i need to research more.
    – unidha
    Commented Mar 23, 2015 at 13:33
  • @unidha Of course it could be done with javascript. BUT you need to implement a double check: JS and Apex. Commented Mar 23, 2015 at 13:36

You must log in to answer this question.

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