STRING_TOO_LONG: meaning and how to fix it
Quick answer
STRING_TOO_LONG: A text value is longer than the maximum length of its field. The message names the field and the maximum length. Start with: Shorten the value, or use the field's max length from the message as the limit.
Typical message: STRING_TOO_LONG, Name: data value too large: ... (max length=80)
Cause
A text value is longer than the maximum length of its field. The message names the field and the maximum length.
How to fix STRING_TOO_LONG
- Shorten the value, or use the field's max length from the message as the limit.
- If the data legitimately needs more room, move it to a Long Text Area field.
- In Apex, truncate deliberately with String.abbreviate or substring before saving.
Have a different message? Paste it into the error decoder, which matches it against 45 common Salesforce errors in your browser.
Frequently asked questions
What does STRING_TOO_LONG mean in Salesforce?
A text value is longer than the maximum length of its field. The message names the field and the maximum length.
How do I fix STRING_TOO_LONG?
1. Shorten the value, or use the field's max length from the message as the limit. 2. If the data legitimately needs more room, move it to a Long Text Area field. 3. In Apex, truncate deliberately with String.abbreviate or substring before saving.
More Data and DML errors
SFDX Talk is unofficial documentation. It is not affiliated with, endorsed by, or sponsored by Salesforce, Inc. Message text varies slightly by release and context, so confirm against the official page before relying on it.