You need to sign in to do that
Don't have an account?
Makam Ruthvik
How to get Recent child record from relatedTo in email content
Hi All,
Please take a look at below lines.
<messaging:emailTemplate subject="{!$Label.SNL_018_EmailSubject}" recipientType="Contact" relatedToType="Account" >
<messaging:htmlEmailBody >
{!relatedTo.Payment_Reminders1__r}
</messaging:htmlEmailBody>
</messaging:emailTemplate>
Here Payment_Reminders1 is child relationship name. From Account I am getting related reminder Id's in a list. How to get the recently created Id from that list. I tried sort by, order by and size etc., None are working. Please help me in this.
Have you tried sorting it by CreatedDate?
Check some reference:
https://salesforce.stackexchange.com/questions/219713/how-to-get-the-latest-created-contact-based-on-the-account
Thanks!
HI Abhinav,
I cannot use apex here since I have to set the email subject of visualforce email template dynamically based on a field on remainder object. I don;t have access to controller here. If the relatedTo is remainder I am able to do it but the related here is Account. Account can have many remainders and have to get the latest created remainder.
Thanks