function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Visual force email template from Apex batch

Have a visual force email template below:


<messaging:emailTemplate subject="{!$Label.Action_Alert_Subject}" recipientType="User" language="{!recipient.LanguageLocaleKey}" relatedToType="User">
<messaging:plainTextEmailBody >
<apex:repeat value="{!relatedTo.Action_Alerts__r}" var="alert">
<apex:outputText value="{!alert.Count__c}"/>
<c:NewLine />

 I have three records owned by a User and when I use the "Send and verify" on the email template, i see the 3 records merged in the final email However when I send the email via apex email from an apex batch the 3 records don't get merged. 



Tried changing the owner of hte related records to the user executing the batch but it still did'nt work. Any ideas would be much appreciated.


Do you find any solution? I'm running in to same issue with batch apex.