Created the following:
- Workflow with alert notification using classic email template.
- Document controller that queried Attachment object
- Apex component to be used in classic email template visualforce page.
current workflow can have alert action that can use classic email template. then classic email template can be of visualforce page.
controller for my apex component
public with sharing class DownloadDocumentController {
:
public Blob attachment {
get {
return Blob.toPdf(pdf);
}
}
}
---------------attachComponent
<apex:component controller="DownloadDocumentController" access="global">
{!attachment}
</apex:component>
---------------
<messaging:emailTemplate ...
<messaging:htmlEmailBody >
...
</messaging:htmlEmailBody>
<messaging:attachment renderAs="pdf" filename="attach.pdf">
<c:attachComponent />
</messaging:attachment>
</messaging:emailTemplate>