You need to sign in to do that
Don't have an account?
Becky Miller 15
New Coder Help
Hello All,
I am trying to make a Visual Force email for our sales team for a list of Accounts that their Service Contracts are expiring soon. I am sure I am missing something but all I get is the headers no detail.
<messaging:emailTemplate subject="Service Contracts Expiring"
recipientType="User"
relatedToType="SVMXC__Service_Contract__c">
<messaging:htmlEmailBody >
<html>
<body>
<STYLE type="text/css">
BODY {font-size: 12px; font-face: arial; }
TH {font-size: 12px; font-face: arial;background: #CCCCCC; border-width: 1; text-align: center; }
TD {font-size: 12px; font-face: verdana; }
TABLE {border: solid #CCCCCC; border-width: 1; }
TR {border: solid #CCCCCC; border-width: 1; }
</STYLE>
<strong>Below are your accounts that are close to Expired Service Contracts</strong>
<table border="0" >
<strong>Accounts Expiring Contracts</strong>
<tr>
<th>Account Name</th><th>Contract Name/Number</th><th>Contract Product Name</th><th>End Date</th><th>Shipping City</th>
</tr>
<apex:repeat >
<tr>
<td>{SVMXC__Company__c}</td>
<td>{Name}</td>
<td>{a.Contract_PN__c}</td>
<td>{a.SVMXC__End_Date__c}</td>
</tr>
</apex:repeat>
</table>
<p />
</body>
</html>
When I do a Preview Template all I get is the nice headers and Subject. I am not sure how to show the data. The Process Builder will be All Accounts whoes expiration date is less than 30 days and then this email will be sent to the Reps that own the accounts.
Thank you for your help in advance. #learning
I am trying to make a Visual Force email for our sales team for a list of Accounts that their Service Contracts are expiring soon. I am sure I am missing something but all I get is the headers no detail.
<messaging:emailTemplate subject="Service Contracts Expiring"
recipientType="User"
relatedToType="SVMXC__Service_Contract__c">
<messaging:htmlEmailBody >
<html>
<body>
<STYLE type="text/css">
BODY {font-size: 12px; font-face: arial; }
TH {font-size: 12px; font-face: arial;background: #CCCCCC; border-width: 1; text-align: center; }
TD {font-size: 12px; font-face: verdana; }
TABLE {border: solid #CCCCCC; border-width: 1; }
TR {border: solid #CCCCCC; border-width: 1; }
</STYLE>
<strong>Below are your accounts that are close to Expired Service Contracts</strong>
<table border="0" >
<strong>Accounts Expiring Contracts</strong>
<tr>
<th>Account Name</th><th>Contract Name/Number</th><th>Contract Product Name</th><th>End Date</th><th>Shipping City</th>
</tr>
<apex:repeat >
<tr>
<td>{SVMXC__Company__c}</td>
<td>{Name}</td>
<td>{a.Contract_PN__c}</td>
<td>{a.SVMXC__End_Date__c}</td>
</tr>
</apex:repeat>
</table>
<p />
</body>
</html>
When I do a Preview Template all I get is the nice headers and Subject. I am not sure how to show the data. The Process Builder will be All Accounts whoes expiration date is less than 30 days and then this email will be sent to the Reps that own the accounts.
Thank you for your help in advance. #learning
<!-- Page: -->
<apex:page controller="repeatCon" id="thePage">
<apex:repeat value="{!strings}" var="string" id="theRepeat">
<apex:outputText value="{!string}" id="theValue"/><br/>
</apex:repeat>
</apex:page>
/*** Controller: ***/
public class repeatCon {
public String[] getStrings() {
return new String[]{'ONE','TWO','THREE'};
}
}
Here in your case, you may need to use the Visualforce component to achieve this as it is a email template.
Regards,
Mahesh
All Answers
<!-- Page: -->
<apex:page controller="repeatCon" id="thePage">
<apex:repeat value="{!strings}" var="string" id="theRepeat">
<apex:outputText value="{!string}" id="theValue"/><br/>
</apex:repeat>
</apex:page>
/*** Controller: ***/
public class repeatCon {
public String[] getStrings() {
return new String[]{'ONE','TWO','THREE'};
}
}
Here in your case, you may need to use the Visualforce component to achieve this as it is a email template.
Regards,
Mahesh
<messaging:emailTemplate recipientType="User"
relatedToType="Quote"
subject="Sales Quote Approval Required: {!relatedTo.name}">
<messaging:htmlEmailBody >
<html>
<body>
<STYLE type="text/css">
BODY {font-size: 12px; font-face: arial; }
TH {font-size: 12px; font-face: arial;background: #CCCCCC; border-width: 1; text-align: center; }
TD {font-size: 12px; font-face: verdana; }
TABLE {border: solid #CCCCCC; border-width: 1; }
TR {border: solid #CCCCCC; border-width: 1; }
</STYLE>
<p><strong><font color="#FF0000">THIS IS CONFIDENTIAL DO NOT FORWARD TO ANYONE</font></strong></p>
<h2>Please approve this Quote</h2>
<strong>The associated Quote and Product info is:</strong>
<br /><strong>Quote Name:</strong> <b><a href="https://na12.salesforce.com/{!relatedTo.id}">{!relatedTo.name}</a></b>
<br /><strong>Account:</strong> {!relatedTo.Opportunity.Account.name}
<br /><strong>Address:</strong> {!relatedTo.Opportunity.Account.ShippingStreet}
<br /><strong>City:</strong> {!relatedTo.Opportunity.Account.ShippingCity}
<br /><strong>State:</strong> {!relatedTo.Opportunity.Account.ShippingState}
<br /><strong>Medivators Account Number:</strong> (If Existing) {!relatedTo.Opportunity.Account.CustomerMasterId__c}
<br /><strong>Sales Rep:</strong> {!relatedTo.Opportunity.owner.name}
<br /><strong>Rep Phone:</strong> {!relatedTo.Opportunity.owner.phone}
<br /><strong>Rep Email:</strong> {!relatedTo.Opportunity.owner.email}
<br /><strong>Total Amount:</strong> ${!ROUND(relatedTo.TotalPrice,0)}
<br /><strong>Opportunity Close Date:</strong> {!month(relatedTo.Opportunity.CloseDate)}/{!day(relatedTo.Opportunity.CloseDate)}/{!year(relatedTo.Opportunity.CloseDate)}
<p/>
<br />
<p/>
<strong>Message to Manager:</strong> {!relatedTo.Message_to_Manager__c}
<p/>
<strong>Status Message:</strong>{!relatedTo.Status_Message__c }<p/>
<table border="0" >
<strong>Product Line Items:</strong>
<tr>
<th>Action</th><th>Product Name</th><th>Product Code</th><th>List Price</th><th>Proposed Price</th><th>Total Price</th><th>Rep Min Pric</th><th>RD Min Price</th><th>Margin</th>
</tr>
<apex:repeat var="q" value="{!relatedTo.QuoteLineItems}">
<tr>
<td>
<a href="https://na12.salesforce.com/{!q.id}">View</a> |
<a href="https://na12.salesforce.com/{!q.id}/e">Edit</a></td>
<td>{!q.Product_Name__c}</td>
<td>{!q.Product_Code__c}</td>
<td>{!ROUND(q.Quantity,0)}</td>
<td>${!ROUND(q.UnitPrice,2)}</td>
<td>${!ROUND(q.TotalPrice,2)}</td>
<td>{!q.Sales_Rep_Min__c}</td>
<td>{!q.RD_Min_Price__c}</td>
<td>{!q.Margin__c}</td>
</tr>
</apex:repeat>
</table>
<p />
<p/>If replying via email you can also add comments on the
second line. The comments will be stored with the approval
request in Salesforce CRM.
Note: For salesforce.com to process your response the word
APPROVE, APPROVED, YES, REJECT, REJECTED, or NO must be in
the very first line of the reply email. Also, any comment
must be in the second line. <p />
</body>
</html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>
You have to use the relationshipname here, I am assuming Accounts is the Child Relationship Name.
<apex:repeat var="acc" value="{!relatedTo.Accounts}">
<tr>
<td>{!acc.Name}</td>
<td>{!acc.Contract_PN__c}</td>
<td>{!acc.SVMXC__End_Date__c}</td>
</tr>
</apex:repeat>
Regards,
Mahesh