I have a custom object with a rich text field, max size 131,072.

Using the force.com REST API, attempting to add an entry with text size larger than about 63,700 characters (I have not pinpointed the exact character length where the failure occurs: it's between 63,700 and 63,750), I get an error like:

[{"message":"Comment: data value too large: Summary: ...",

Am I running into a character encoding problem? I note the actual max number of characters I can send is somewhat less than half the field's max size.


I can add the full 131,072 characters if the text I send does not include HTML tags. The text that is failing is about 70k chars and contains 2 lengthy HTML tables, so there are lots of tags. What is salesforce doing to my text to double its size?


OK, so SF is adding attributes to my HTML. From this

<table border="2"><tbody><tr><th>x</th><th>y</th></tr><tr><td>0</td><td>1</td></tr></tbody></table>

to this

<table border="2"><tbody><tr><th colspan="1" rowspan="1">x</th><th colspan="1" rowspan="1">y</th></tr><tr><td colspan="1" rowspan="1">0</td><td colspan="1" rowspan="1">1</td></tr></tbody></table>
<!-- ...........................^^^^^^^^^^^^^^^^^^^^^^^^

My original text is 69,816 chars, and contains 2 large tables with 3264 td and th tags. Adding the colspan and rowspan attributes balloons the text to 144,888 chars.

Is there any way to control what SF is doing to my HTML?

  • 1
    Does the same problem occur when you try to insert the same string in a long text field of the same length? Perhaps the rich text field adds characters for formatting (html tags etc). – Folkert Nov 16 '17 at 16:16
  • I'll check that, but adding 58,000 chars? – glenn jackman Nov 16 '17 at 16:26
  • Experiment: If you paste an HTML table via data loader into a RTF, does SFDC automatically add the colspan and rowspan? – cropredy Nov 17 '17 at 5:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.