Who is the "Current User" when a time based workflow fires in the future? I have Entitlement Milestone email alerts scheduled in the future, and the "From" (on behalf of) appears to be selected randomly. I have seen instances where it is not the creator or owner of the Case record being alerted on, nor did that user ever own or edit the record (from what I can see in the history).
I reference the current user twice in the template, once as the from, and once in the body of the message. It is a VF email template, that looks like this:
<messaging:emailTemplate
subject="CASE: {!relatedTo.casenumber} has exceeded 60% of SLA time"
recipientType="User"
relatedToType="Case" >
<messaging:HtmlEmailBody >
Please review and resolve.
{!relatedTo.Subject} Case {!relatedTo.CaseNumber} will exceed its SLA level on:<br/>
<apex:repeat value="{!relatedTo.casemilestones}" var="cm">
<apex:outputfield value="{!cm.Milestonetype.name }" /> -
<c:VFEmailDateTime date_time_value="{!cm.TargetDate}" />
</apex:repeat><br/><br/>
Submitting Agent: {!$User.FirstName} {!$User.LastName}<br/>
Case Owner: {!relatedTo.Owner.Name} {!IF(relatedTo.Owner.Type=="Queue","Queue","")}
<br/>
To access the case, use this link: <br/>
<apex:outputlink
value="!LEFT($Api.Partner_Server_URL_140,
FIND('.com',$Api.Partner_Server_URL_140)+4)+relatedTo.Id}">
{!relatedTo.CaseNumber}
</apex:outputlink><br/>
</messaging:HtmlEmailBody>
</messaging:emailTemplate>
This random user also appears on the "Submitting Agent" line. I assumed it would be the user that caused the condition to be true for the milestone (and alert) to be queued.
Thanks!