Since messaging:plainTextEmailBody
can't have HTML, and, an outputPanel
is a div
or span
and hence it won't work. So, how to work around?
Option 1: Use a custom component w/ controller
So, assuming you are getting Cases for an Account:
Create a custom component <c:theCases accountId={!someAcctMergeField}/>
The custom component would:
- Be associated with a controller
- Do the filtering in the controller based on values passed through the component's attributes and/or queried from the database
- Return a list of Cases ...
- That are the
value={!...}
attribute of the repeat
and ...
- Can be rendered as HTML in the
HtmlEmailBody
and as plain text in the plainTextEmailBody
That is, move the rendering logic out to the custom component's controller
Update: You could also use the rendered=
attribute on the <c:myCustomComponent ..>
to decide to render the component at all (in effect, acting like the outputPanel rendered= )
Option 2 - move the rendering condition onto the apex:repeat
(if possible)