0

Visual Force Code: (See bottom for URL Hack)Thanks

<messaging:emailTemplate subject="Deal Approval Requested" recipientType="User"      relatedToType="Contract_Assist__c">
      <messaging:htmlEmailBody >
<html>
    <body>

     <p>{!relatedTo.Owner.Name} is requesting deal approval for the following opportunity.</p>
     <p>Title:{!relatedTo.Owner.Title}</p>
     <p>RVP Sponsor:{!relatedTo.RVP_Sponsor__r.name}(RVP)</p>
     <p>Customer Name: {!relatedTo.BillToCustomer__c}</p>
     <p>Type:{!relatedTo.New_or_Renewal__c}</p>
     <p>Contract Length (Weeks): <apex:outputText value="{0, number, #0}"><apex:param value="{!relatedTo.Contract_Length_Weeks__c}"/></apex:outputText></p>
     <p>AWRV:<apex:outputText value="{0, number, $#0.00}"><apex:param value="{!relatedTo.AWRV_Actual__c}"/></apex:outputText></p>
     <p>Account Review Comments:{!relatedTo.Account_Review_Comments__c}</p>
     <p>First Year Amortization %(Merchandise % of Rental):<apex:outputText value="{0, number, #0.0}"><apex:param value="{!relatedTo.First_Year_Amort_Cost_Percent__c}"/></apex:outputText>%</p>
     <p>Payback Weeks:<apex:outputText value="{0, number, #0.0}"><apex:param value="{!relatedTo.Overall_Payback_Weeks__c}"/></apex:outputText></p>
     <p>Discount Percent (Green):<apex:outputText value="{0, number, #0.0}"><apex:param value="{!relatedTo.Overall_Green_Price_Variance_Percent__c}"/></apex:outputText>%</p>
     <p>Account Review Comments:{!relatedTo.Account_Review_Comments__c}</p>
    <p>Below is a list of line items:</p>
    <table border="1" >
        <tr > 
            <th>Description</th>
            <th>Code</th>
            <th>AWRV</th>
            <th>Rental Rate</th>
            <th>Replacement Rate</th>
            <th>Items Per Wearer</th>
            <th># of Wearers</th>
            <th>Total Inventory</th>
            <th>Bill %</th>
            <th>Payback Weeks</th>
            <th>Discount % from Green Rates</th>
            <th>Wkly Amort</th>

                       </tr>
    <apex:repeat var="CALI" value="{!relatedTo.Contract_Assist_Line_Items__r}">
          <tr Align="Right">
            <td>{!CALI.Item_Description__c}</td>
            <td>{!CALI.Code__c}</td>
            <td><apex:outputText value="{0, number, $#0.00}"><apex:param value="{!CALI.AWRV_Actual__c}"/></apex:outputText></td>           
            <td><apex:outputText value="{0, number, $#0.000}"><apex:param value="{!CALI.Contract_Price__c}"/></apex:outputText></td>
            <td><apex:outputText value="{0, number, $#0.00}"><apex:param value="{!CALI.Item_Replacement_Charge__c}"/></apex:outputText></td>
            <td><apex:outputText value="{0, number, #0}"><apex:param value="{!CALI.Number_of_Items_Per_Wearer__c}"/></apex:outputText></td>              
            <td><apex:outputText value="{0, number, #0}"><apex:param value="{!CALI.Number_of_Wearers__c}"/></apex:outputText></td> 
            <td><apex:outputText value="{0, number, #0}"><apex:param value="{!CALI.Usage__c}"/></apex:outputText></td> 
            <td><apex:outputText value="{0, number, #0}"><apex:param value="{!CALI.Bill_Percentage__c}"/></apex:outputText></td>
            <td><apex:outputText value="{0, number, #0.0}"><apex:param value="{!CALI.Payback_Weeks__c}"/></apex:outputText></td> 
            <td><apex:outputText value="{0, number, #0.0}"><apex:param value="{!CALI.Green_Variance_Percent__c}"/></apex:outputText>%</td>
            <td><apex:outputText value="{0, number, $#0.00}"><apex:param value="{!CALI.Weekly_Amort__c}"/></apex:outputText></td>

          </tr>
        </apex:repeat> 
      </table>    
    </body>
</html>
 </messaging:htmlEmailBody>
</messaging:emailTemplate>

URL Hack:

location.replace('/email/author/emailauthor.jsp?retURL=/{!Contract_Assist__c.Id}&template_id=00XQ0000000Ie9e&p5=');
2
  • 1
    what do you mean by template not executed? Commented Oct 29, 2013 at 18:43
  • Only the template is shown. The merged fields that Visualforce is to get are all blank. It works fine in the "Send Test and Verify Merge Fields" wizard in creating the template.
    – LeoT
    Commented Oct 29, 2013 at 22:40

2 Answers 2

1

That author email URL will only work with HTML and text. If you use the regular "select template" button on an email, you will see the VF templates are not listed.

0
/email/author/emailauthor.jsp?
    retURL=/{!Contract_Assist__c.Id}&
    template_id=00XQ0000000Ie9e&
    p5=

There's nothing to merge to ;) where's your p3 and p3_lkid? "related to" (Account, Case, custom object like this Contract_Assist__c etc) - the record from which the data should be pulled.

I can't vote for duplicate as my answer there has no upvotes but... Mail Merge Button

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .