1

I'm working on a functionality that sends an email to the user with a links to a list of documents. The following is the code from .email VF template that does it.

<!-- starting lines of email --> 

Please find the the link(s) below:<br/>
<c:EG_FetchFiles recordId="{!rec.Id}">
</c:EG_FetchFiles>

<!-- ending lines of email --> 

The c:EG_FetchFiles provides the links to related Files. I want to render the Please find the the link(s) below line only if the EG_FetchFiles provides any links.

I have tried apex:outputPanel with rendered condition as {!rec.Id} but this always evaluates to true. Is there a way I can render the line only if the component returns any links?

4
  • Could you refactor the EG_FetchFiles component to accept the preamble message as an attribute and ensure it is rendered if there is a link, and not otherwise?
    – Phil W
    Commented Mar 31, 2022 at 15:06
  • @PhilW yeah, I have that down as the last resort but I'm still trying/hoping to find a way inside the VF page even if its a hack.
    – Kishan B
    Commented Mar 31, 2022 at 15:08
  • I don't think you will achieve what you want, even as a hack, and will need to make the component deal with this. Honestly, it's the right thing to do (though using a label would be even better since it would allow localization).
    – Phil W
    Commented Mar 31, 2022 at 15:17
  • Does the outer VF email template relatedTo object have a field that is the count of files in a field. If so, you could use an apex:outputText with a rendered= property. Otherwise, Phil's suggestion is the right one
    – cropredy
    Commented Mar 31, 2022 at 22:01

0

You must log in to answer this question.