For a low/no code solution, you could play around with something like this:
Step 1: Create a Picklist on your custom object (lets call this Template__c on object Invoice__c) which will be used to dictate the Email templateattachment content, e.g. Picklist values
- Email Template 1
- Email Template 2
- Email Template 3
Step 2: Create your Email template as a Visualforce template, only rendering the relevant content for your attachment, for example:
<messaging:emailTemplate subject="FinancialForce Invoice Generationsubject="Invoice - {!relatedTo.Name}" recipientType="Contact" relatedToType="Invoice__c">
<messaging:attachment renderAs="pdf" filename="{!relatedTo.Name} rendered="{!relatedTo.Template__c == 'Email Template 1'}">
<c:MyVFForTemplate1/>
</messaging:attachment>
<messaging:attachment renderAs="pdf" filename="{!relatedTo.Name} rendered="{!relatedTo.Template__c == 'Email Template 2'}">
<c:MyVFForTemplate2/>
</messaging:attachment>
<messaging:attachment renderAs="pdf" filename="{!relatedTo.Name} rendered="{!relatedTo.Template__c == 'Email Template 3'}">
<c:MyVFForTemplate3/>
</messaging:attachment>
<messaging:htmlEmailBody >
Dear Customer,
Here is your Invoice. Please pay now, or else!
</messaging:htmlEmailBody>
</messaging:emailTemplate>
(note, i have illustrated the example using a VF component but you could just as well copy/paste the VF page content into the Email template.
Step 3: Create a workflow rule with the following attributes:
- Object = Invoice (Invoice__c)
- Evaluate the rule when a record is: created, and any time it’s edited to subsequently meet criteria
- Run this rule if the following criteria are met Template__c = 'Email Template 1' or 'Email Template 2' or 'Email Template 3'
- 'Save & Next'
Step 4: Add a new Workflow Action: New Email Alert, selecting the Email template you just created
Step 5: Enable/Activate your workflow
Step 6: Update your Invoice record's Picklist value to one of the relevant picklist values and the workflow should fire (as a result of Step 3) sending an email (as a result of Step 4) in the format required (as a result of Step 2).
I haven't tested the above, as I've just typed it directly in here but this approach works as I have used it before.