You need to sign in to do that
Don't have an account?
shakila G
How to append the send mail logic in render as pdf ?
I designed the visual force page as quote template(Render as pdf). I passed this visual force page as a custom button in detail page. Once the button click.It's opening the preview of the visual force page. In that, I want to add a send mail logic.
Kindly let me know how to proceed with sending mail logic on this:
This is my visual force code:
<apex:page standardController="Quote" extensions="sendmailtocustomer"
showHeader="false" applyHtmlTag="false" applyBodyTag="false" renderAs="PDF" >
<html>
<head>
<style type="text/css" media="print">
@page {
size: A4;
margin: 2in
0.6in
0.2in
0.5in;
@top-center
{
content: element(header);
}
@Bottom-right
{
content: "Page " counter(page);
}
}
div.header {
margin-top: 1em;
position: running(header);
color: #191970; }
</style>
<style>
body {
background-image: url("https://test--c.ap4.visual.force.com/resource/1522828231000/BG_New") ;
background-repeat:repeat-y;
background-size:contain;
background-blend-mode:saturation;
}
</style>
<body style="font-family: sans-serif; font-weight: normal; font-size: 8pt;" >
<div class="header">
<table width="100%" cellspacing="0" cellpadding="0">
<tr>
<td valign="top"><img src="{!$Resource.LetterHead}" width="700" /></td>
</tr>
</table>
</div>
<br/>
<br/>
<table width="100%">
<tr height="30">
<th width="20%" style="vertical-align:top;">Customer Name</th>
<td width="20%" style="vertical-align:top;">{!Quote.Account.Name}</td>
<th width="18%" style="vertical-align:top;">Quote Number</th>
<td width="25%" style="vertical-align:top;">{!Quote.Quote_Number__c}</td>
</tr>
<tr height="60">
<th style="vertical-align:top;">Billing Address</th>
<td style="vertical-align:top;"><apex:outputtext style="width:10%;word-wrap: break-word;" value="{!Quote.account.BillingStreet}"/><br/>
{!Quote.account.BillingCity},
{!Quote.account.BillingState} -
{!Quote.account.BillingPostalCode},
{!Quote.account.BillingCountry}</td>
<th width="20%" style="vertical-align:top;">Quotation Date</th>
<td width="20%" style="vertical-align:top;">{!Quote.Quotation_Date__c}</td>
</tr>
<tr height ="30">
<th style="vertical-align:right">GST No</th>
<td width="25%" style="vertical-align:top;">{!Quote.GST_No__c}</td>
</tr>
<tr height="30">
<th style="vertical-align:Right;">Quotation Date</th>
<td style="vertical-align:right;"><apex:outputText value="{0,date,dd/MM/yy}"> <apex:param value="{!Quote.Quotation_Date__c}" /> </apex:outputText></td>
</tr>
<tr height="30">
<th style="vertical-align:top;">Opportunity Name</th>
<td style="width:45%;vertical-align:top;">{!Quote.Opportunity.Name}</td>
</tr>
</table>
<br/>
<table>
<tr>
<td><apex:outputtext value="{!Quote.Letter_Head_New__c}" escape="false"/></td>
</tr>
</table>
<br/>
<table width="100%" border="1" border-style="solid;" style="border-collapse: collapse;" >
<tr height="30" width="100%" style="font-family: sans-serif; white-space:nowrap;font-weight: bold; font-size: 10pt; background-color:Gray;">
<th >S.No</th>
<th > Product Name</th>
<th > Image*</th>
<th >Quantity</th>
<th style="white-space:nowrap;" >Sales Price</th>
<th > GST%</th>
<th style="white-space:nowrap;">Discount Amount</th>
<th style="white-space:nowrap;">After Discount</th>
</tr>
<apex:variable value="{!0}" var="index" />
<apex:repeat value="{!Quote.QuoteLineItems}" var="Qli">
<apex:variable value="{!index + 1}" var="index" />
<tr>
<td style="text-align:center;" border-style="solid;" >{!index}.</td>
<td style="text-align:left;" border-style="solid;" >{!Qli.Product2.Name}</td>
<td style="text-align:center;"><apex:outputText escape="false" value="{!Qli.Image__c}"/></td>
<td style="text-align:center;" border-style="solid;" >{!Qli.Quantity}</td>
<td style="text-align:center;" border-style="solid;" >{!Qli.UnitPrice}</td>
<td style="text-align:center;" border-style="solid;" >{!Qli.GST__c}</td>
<td style="text-align:right;" border-style="solid;" >{!Qli.Discount_Amount__c}</td>
<td style="text-align:right;" border-style="solid;" >{!Qli.Tax_After_Discount__c}</td>
</tr>
</apex:repeat>
</table>
<br/>
<apex:outputText style="page-break-inside: auto;" escape="false">
<table style="page-break-inside: auto;" width="100%">
<tr>
<th></th><td></td>
<th style="text-align:right;">Total Sales Price</th><td width="80" style="text-align:right;">{!Quote.TotalPrice}</td>
</tr>
<tr>
<th></th><td></td>
<th style="text-align:right;">Gross Total</th><td style="text-align:right;">{!Quote.Gross_Total__c}</td>
</tr>
<tr>
<th></th><td></td>
<th style="text-align:right;">GST Amount</th><td style="text-align:right;">{!Quote.Tax_Amount__c}</td>
</tr>
<tr>
<th></th><td></td>
<th style="text-align:right;">Sub Total</th><td style="text-align:right;">{!Quote.Sub_Total__c }</td>
</tr>
<tr>
<th></th><td></td>
<th style="text-align:right;">Net Pay</th><td style="text-align:right;">{!Quote.Net_Pay__c}</td>
</tr>
</table>
<br/>
</apex:outputText>
<apex:outputText >
<table style="page-break-inside: avoid;">
<tr>
<th></th><td></td>
<tr> <th> Terms and Condition: </th></tr>
<tr>
<td style="text-align:left" ><apex:outputtext value="{!Quote.Terms_Conditions__c}" escape="false"/></td>
</tr>
</tr>
<tr> <th></th><td></td></tr>
<tr> <th></th><td></td></tr>
<tr height="30">
<td><b>Price Book Ref No.</b> {!Quote.Price_Book_Ref_No__c}</td>
</tr>
<tr>
<td><b>Prepared By</b> {!Quote.Prepared_By__c}</td>
</tr>
</table>
<br/>
<p style="font-size:10px;">* The images shown in this quotation are for reference only. Our Company reserves the right to change the design, color and specifications of the products with out any prior notice.</p>
</apex:outputText>
</body>
</head>
</html>
</apex:page>
Kindly let me know how to proceed with sending mail logic on this:
This is my visual force code:
<apex:page standardController="Quote" extensions="sendmailtocustomer"
showHeader="false" applyHtmlTag="false" applyBodyTag="false" renderAs="PDF" >
<html>
<head>
<style type="text/css" media="print">
@page {
size: A4;
margin: 2in
0.6in
0.2in
0.5in;
@top-center
{
content: element(header);
}
@Bottom-right
{
content: "Page " counter(page);
}
}
div.header {
margin-top: 1em;
position: running(header);
color: #191970; }
</style>
<style>
body {
background-image: url("https://test--c.ap4.visual.force.com/resource/1522828231000/BG_New") ;
background-repeat:repeat-y;
background-size:contain;
background-blend-mode:saturation;
}
</style>
<body style="font-family: sans-serif; font-weight: normal; font-size: 8pt;" >
<div class="header">
<table width="100%" cellspacing="0" cellpadding="0">
<tr>
<td valign="top"><img src="{!$Resource.LetterHead}" width="700" /></td>
</tr>
</table>
</div>
<br/>
<br/>
<table width="100%">
<tr height="30">
<th width="20%" style="vertical-align:top;">Customer Name</th>
<td width="20%" style="vertical-align:top;">{!Quote.Account.Name}</td>
<th width="18%" style="vertical-align:top;">Quote Number</th>
<td width="25%" style="vertical-align:top;">{!Quote.Quote_Number__c}</td>
</tr>
<tr height="60">
<th style="vertical-align:top;">Billing Address</th>
<td style="vertical-align:top;"><apex:outputtext style="width:10%;word-wrap: break-word;" value="{!Quote.account.BillingStreet}"/><br/>
{!Quote.account.BillingCity},
{!Quote.account.BillingState} -
{!Quote.account.BillingPostalCode},
{!Quote.account.BillingCountry}</td>
<th width="20%" style="vertical-align:top;">Quotation Date</th>
<td width="20%" style="vertical-align:top;">{!Quote.Quotation_Date__c}</td>
</tr>
<tr height ="30">
<th style="vertical-align:right">GST No</th>
<td width="25%" style="vertical-align:top;">{!Quote.GST_No__c}</td>
</tr>
<tr height="30">
<th style="vertical-align:Right;">Quotation Date</th>
<td style="vertical-align:right;"><apex:outputText value="{0,date,dd/MM/yy}"> <apex:param value="{!Quote.Quotation_Date__c}" /> </apex:outputText></td>
</tr>
<tr height="30">
<th style="vertical-align:top;">Opportunity Name</th>
<td style="width:45%;vertical-align:top;">{!Quote.Opportunity.Name}</td>
</tr>
</table>
<br/>
<table>
<tr>
<td><apex:outputtext value="{!Quote.Letter_Head_New__c}" escape="false"/></td>
</tr>
</table>
<br/>
<table width="100%" border="1" border-style="solid;" style="border-collapse: collapse;" >
<tr height="30" width="100%" style="font-family: sans-serif; white-space:nowrap;font-weight: bold; font-size: 10pt; background-color:Gray;">
<th >S.No</th>
<th > Product Name</th>
<th > Image*</th>
<th >Quantity</th>
<th style="white-space:nowrap;" >Sales Price</th>
<th > GST%</th>
<th style="white-space:nowrap;">Discount Amount</th>
<th style="white-space:nowrap;">After Discount</th>
</tr>
<apex:variable value="{!0}" var="index" />
<apex:repeat value="{!Quote.QuoteLineItems}" var="Qli">
<apex:variable value="{!index + 1}" var="index" />
<tr>
<td style="text-align:center;" border-style="solid;" >{!index}.</td>
<td style="text-align:left;" border-style="solid;" >{!Qli.Product2.Name}</td>
<td style="text-align:center;"><apex:outputText escape="false" value="{!Qli.Image__c}"/></td>
<td style="text-align:center;" border-style="solid;" >{!Qli.Quantity}</td>
<td style="text-align:center;" border-style="solid;" >{!Qli.UnitPrice}</td>
<td style="text-align:center;" border-style="solid;" >{!Qli.GST__c}</td>
<td style="text-align:right;" border-style="solid;" >{!Qli.Discount_Amount__c}</td>
<td style="text-align:right;" border-style="solid;" >{!Qli.Tax_After_Discount__c}</td>
</tr>
</apex:repeat>
</table>
<br/>
<apex:outputText style="page-break-inside: auto;" escape="false">
<table style="page-break-inside: auto;" width="100%">
<tr>
<th></th><td></td>
<th style="text-align:right;">Total Sales Price</th><td width="80" style="text-align:right;">{!Quote.TotalPrice}</td>
</tr>
<tr>
<th></th><td></td>
<th style="text-align:right;">Gross Total</th><td style="text-align:right;">{!Quote.Gross_Total__c}</td>
</tr>
<tr>
<th></th><td></td>
<th style="text-align:right;">GST Amount</th><td style="text-align:right;">{!Quote.Tax_Amount__c}</td>
</tr>
<tr>
<th></th><td></td>
<th style="text-align:right;">Sub Total</th><td style="text-align:right;">{!Quote.Sub_Total__c }</td>
</tr>
<tr>
<th></th><td></td>
<th style="text-align:right;">Net Pay</th><td style="text-align:right;">{!Quote.Net_Pay__c}</td>
</tr>
</table>
<br/>
</apex:outputText>
<apex:outputText >
<table style="page-break-inside: avoid;">
<tr>
<th></th><td></td>
<tr> <th> Terms and Condition: </th></tr>
<tr>
<td style="text-align:left" ><apex:outputtext value="{!Quote.Terms_Conditions__c}" escape="false"/></td>
</tr>
</tr>
<tr> <th></th><td></td></tr>
<tr> <th></th><td></td></tr>
<tr height="30">
<td><b>Price Book Ref No.</b> {!Quote.Price_Book_Ref_No__c}</td>
</tr>
<tr>
<td><b>Prepared By</b> {!Quote.Prepared_By__c}</td>
</tr>
</table>
<br/>
<p style="font-size:10px;">* The images shown in this quotation are for reference only. Our Company reserves the right to change the design, color and specifications of the products with out any prior notice.</p>
</apex:outputText>
</body>
</head>
</html>
</apex:page>
Did you want to build a functionality like the standard Send Email of the Quote correct?
What you can do is create another page and use this vf page in the Iframe to show the preview. In this new page create the buttons as you want and then in the controller you can put the logic for the same.
Regards,
Amit
http://www.sfdcpanther.com/
All Answers
See below article
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_email_sending_attachments.htm
Did you want to build a functionality like the standard Send Email of the Quote correct?
What you can do is create another page and use this vf page in the Iframe to show the preview. In this new page create the buttons as you want and then in the controller you can put the logic for the same.
Regards,
Amit
http://www.sfdcpanther.com/