I am trying to fetch all the Opportunities associated with the User.Below is the Visualforce Email Template. I am stuck with the line of the code
received error: Error: Invalid field Opportunities__r for SObject User
<messaging:emailTemplate recipientType="User" relatedToType="User" subject="Opportunity report for User: {!relatedTo.Name}"
language="{!recipient.LanguageLocaleKey}">
<messaging:htmlEmailBody>
<html>
<body>
<p> Dear {!recipient.Name},</p>
<p>Below is the list of opportunities . </p>
<p>table border = "0" </p>
<p> Close Date</p> <p>Opportunity Name</p>
<th>Amount</th> <th>Stage</th>
</tr>
<apex:repeat var="Opp" value="{!relatedTo.Opportunities__r}">
<apex:OutputPanel rendered = "{!Opp.MightyHR__Closein7days__c = 1}" >
<tr>
<td><a href =" https://gopagoni-dev-ed.my.salesforce.com/{!Opp.Id}">{!Opp.CloseDate}</a></td>
<td>{!Opp.Name}</td>
<td> {!Opp.Amount}</td>
<td>{!Opp.Stage}</td>
</tr>
</apex:OutputPanel>
</apex:repeat>
</table>
<p/>
<center>
<apex:outputLink value="http://www.salesforce.com">
For more detailed information login to Salesforce.com
</apex:outputLink>
</center>
</body>
</html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>
relatedTo.Opportunities__r
related records. you may require controller help here. Try like this.. infallibletechie.com/2013/05/…