
Email Template:
<messaging:emailTemplate subject="Milestone:{!relatedTo.MilestoneType.Name} - yet to complete" recipientType="Contact" relatedToType="CaseMilestone">
<messaging:htmlEmailBody ><br/><br/><br/>
*** Milestone Warning **** <br/><br/>
<c:MSCaseDetails MScaseId="{!relatedTo.CaseId}"/><br/>
Milestone Name: {!relatedTo.MilestoneType.Name}<br/>
Target Date: {!relatedTo.TargetDate}<br/>
Elapsed Time (Mins): {!relatedTo.ElapsedTimeInMins}<br/>
Time Remaining (Mins): {!relatedTo.TimeRemainingInMins}<br/><br/>
Case reference: https://cs42.salesforce.com/{!relatedTo.CaseId} <br/><br/><br/>
Kindly remember to complete the milestone before it expires.<br/><br/><br/>
</messaging:htmlEmailBody>
</messaging:emailTemplate>
VF Componenet:
<apex:component controller="FindCaseDetails" access="global">
<apex:attribute name="MScaseId" description="testing" type="Id" required="required" assignTo="{!caseId}"/>
Case#: <apex:outputField value="{!CaseDetails.CaseNumber}"/> <br/>
Assigned To: <apex:outputField value="{!CaseDetails.Owner.Name}"/>
</apex:component>
Contoller:
public class FindCaseDetails {
public static Case cs;
public static Id caseId {get;set;}
public FindCaseDetails() {
}
public Case getCaseDetails() {
cs = [select CaseNumber, Owner.Name from Case where id =:caseId];
return cs;
}
}
Here is my setup to trigger a warning for a case milestone. I'm getting the alert by it has no MileStone Information in it.
Alert I received upon milestoine warning is:
Subject: Sandbox: Milestone: - yet to complete
Email Body:
*** Milestone Warning ****
Case#:00076658
Assigned To:New Cases
Milestone Name:
Target Date:
Elapsed Time (Mins):
Time Remaining (Mins):
Case reference: https://cs42.salesforce.com/
Kindly remember to complete the milestone before it expires.
But, when I test the email template manually from EmailTemplate page,
It will ask me to enter,
Contact ID: <contact ID>
and
CaseMilestone ID: <milestone ID>
this works. And the test alert contains the expected output,
*** Milestone Warning ****
Milestone Name: Main Category Set
Target Date: Wed Jun 22 19:30:20 GMT 2016
Elapsed Time (Mins):
Time Remaining (Mins): 00:00
Case reference: https://cs42.salesforce.com/500560000037EGyAAM
Kindly remember to complete the milestone before it expires.
Someone please let me know, why the alert is not displaying the milestone details during the actual execution.