Developer Console: STRING_TOO_LONG

OpFocus Offsite in BermudaI was working feverishly to fix a large VF page at a company offsite in Bermuda.  Trouble in paradise, because while programming with a Mai Tai in hand is soothing, the internet connection was flaky.  My Force IDE project kept timing out.  Then Eclipse informed me that the project was corrupted. Agh!

That’s okay, I only had to make a couple of changes so the Developer Console, the browser based tool, would be fine.  I made the updates, hit save… STRING_TOO_LONG.  Wha…???


I had surpassed the limit of the Developer Console.  This is a known issue.

My numbers were as follows:  84KB, 1947 lines, 1023 lines of JavaScript, 57 lines of CSS.  I had to reduce the VF page to less than 50KB.

The solution was to split out most of the JavaScript into a separate file, put it into Salesforce as a static resource.  I was also able to pull some CSS into a static resource.  Then include a reference to them in the VF:

<apex:includeScript value="{!URLFOR($Resource.myJS)}" />
<apex:stylesheet value="{!URLFOR($Resource.myCSS)}" />

This, and a few other changes got the page down to around 40KB, and I was finally able to save the VF page.

However, if I had given it a little more thought I would have seen a simpler answer.  According to the link above, I could edit and save using the simple editor in Setup->Develop->Pages-> <the page> -> Edit.  It was only a couple of quick changes, so I should have gone this route instead.  The Force IDE is richly featured.  The Developer Console gains more features all the time.  However, there is still the option of a simple editor, the Salesforce equivalent of Notepad (or Notepad++, BBEdit, et al).