I am creating a visualforce email template that sends contact data to salespeople.
In this email there are two points that I am not able to advance:
In the section "Informações sobre o agendamento", I would like that the apex repeat that has below it to bring the start and end date information only if the subject of the event starts with "Agd:"
Below in "Tarefas Relacionadas" and "Compromissos relacionados" I needed the subject of each task or event to link to those tasks, but I don't know how to bring the link to custom shape.
Could someone please help me with these questions?
Below I leave all the email code for analysis :)
<messaging:emailTemplate subject="Novo agendamento!" recipientType="Contact" relatedToType="Contact">
<messaging:htmlEmailBody >
<html>
<body>
<table>
<tr>
<p>Olá{!relatedto.Owner.FirstName}, tudo bem?</p>
</tr>
<tr>
<p>Você tem uma nova reunião agendada!</p>
</tr>
<tr>
<p>Confira abaixo tudo o que você precisa saber sobre seu lead e o agendamento!</p>
</tr>
</table>
<table>
<tr>
<th>Informações sobre o agendamento</th>
</tr>
<apex:repeat rows="1" value="{!relatedTo.Events}" var="event">
<tr>
<p><strong> Início: </strong>{!event.StartDateTime}</p>
<p><strong> Fim: </strong>{!event.EndDateTime}</p>
</tr>
</apex:repeat>
<tr>
<p><strong>Nome da empresa:</strong> {!relatedto.Account.Name}</p>
</tr>
<tr>
<p><strong>Site:</strong> {!relatedto.Account.Website}</p>
</tr>
<tr>
<p><strong>Telefone:</strong> {!relatedto.Phone}</p>
</tr>
<tr>
<p><strong>Nome:</strong> {!relatedto.Name}</p>
</tr>
<tr>
<p><strong>Cargo:</strong> {!relatedto.Title}</p>
</tr>
<tr>
<p><strong>E-mail:</strong> {!relatedto.Email} </p>
</tr>
<tr>
<p><strong>Setor:</strong> {!relatedto.Account.Industry}</p>
</tr>
</table>
<table>
<tr>
<th>Tarefas Relacionadas</th>
</tr>
<apex:repeat rows="5" value="{!relatedTo.Tasks}" var="tarefa">
<tr>
<td>
<p><strong> Assunto: </strong>{!tarefa.Subject}</p>
</td>
</tr>
</apex:repeat>
</table>
<table>
<tr>
<th>Compromissos relacionados</th>
</tr>
<apex:repeat rows="5" value="{!relatedTo.Events}" var="compromisso" >
<tr>
<td>
<p><strong> Assunto: </strong>{!compromisso.Subject}</p>
</td>
</tr>
</apex:repeat>
</table>
</body>
</html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>