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
Kalai ArumugamKalai Arumugam 

Email Alert for CaseMilestone not working

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, where the CaseMilestone details are missing here,
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>.
And this works as 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.


 
SalesFORCE_enFORCErSalesFORCE_enFORCEr
Make sure you have given proper access to profiles on Milestone object, fields and the controller of the vf component used in the template