I have a custom page to preview and render Email templates, now i came across that some (not many) templates will exceed the view state of the page ( max 137kb) As I need the function to replace text within the template the displayed variable (transient) needs to be at some point be reassigned with a new value, but as soon i do that in the code (touching the value of that var again by assigning a new string the page drops out with the view state exceeded error (already on loading the page after selecting the template) if I don't "touch" the variable all is fine here is how i show the preview.
<apex:pageBlockSection title="Preview" columns="1">
<apex:outputText value="{!theTempl}" escape="false" />
</apex:pageBlockSection>
some other templates on the other hand work fine but one of them throws an error STRING_TOO_LONG, HTML Body: data value too large: As soon it goes to be assembled in a complete email But I could not find any limits for the EmailTemplate htmlValue
1) Does anyone got an idea how to avoid this view state thing, as this is only on some templates 2) How can I avoid this String too Long error, when all other actions ( string replace) went fine and only next stop is to send out the email
Thanks