You need to sign in to do that
Don't have an account?
Sushma Ramakrishnan 5
Getting Error occurred trying to load the template for preview: List has no rows for assignment to SObject. Please try editing your markup to correct the problem. error on Email Template
Hi All,
I am getting the below Error for my Template - VF_Quote Email Template :
Error occurred trying to load the template for preview: List has no rows for assignment to SObject. Please try editing your markup to correct the problem.
Code for VF_Quote Email Template (Visualforce Template):
I am getting the below Error for my Template - VF_Quote Email Template :
Error occurred trying to load the template for preview: List has no rows for assignment to SObject. Please try editing your markup to correct the problem.
Code for VF_Quote Email Template (Visualforce Template):
<messaging:emailTemplate subject="Dear Approver, Quote Number {!relatedTo.QuoteNumber} {!relatedTo.Name} was sent for your approval {!relatedTo.Urgent_Text__c}" recipientType="Contact" relatedToType="Quote"> <messaging:htmlEmailBody > <html> <img src="http://photos.prnewswire.com/prnvar/20120528/535447?max=400" width="250" height="30"/> <head> <meta content="text/html;charset=utf-8" http-equiv="Content-Type"/> <meta name="Template" content="Response"/> <style> td { text-align: right; font-family: Verdana; } p{ text-align: left; font-family: Verdana; } h3 { font-family: Verdana; } </style> </head> <body> <br/> <p> <h3><b> Dear Approver, </b> </h3> </p> <br/> <p> <b> Quote {!relatedTo.QuoteNumber} {!relatedTo.Name} was sent for your approval . <font color="#FF9900"> <apex:outputText value="Urgent" rendered="{!relatedTo.Urgent__c}"/> </font></b> </p> <p> <u> <b> Opportunity Owner : </b> </u> <c:QuoteEmailTemplate2 theQuoteId="{!relatedTo.Id}"/> </p> <p> <u> <b> Opportunity Territory : </b> </u> <c:QuoteEmailTemplate3 theQuoteId="{!relatedTo.Id}"/> </p> <p> <u> <b> Account : </b> </u> {!relatedTo.BillingName} (#{!relatedTo.Account_Number__c })</p> <p> <u> <b>Sales Type:</b> </u> {!relatedTo.bl_Sales_Type__c} </p> <p> <u> <b> Upgrade/Traded : </b> </u> {!relatedTo.Upgrade_Traded_In_Equipment_Type__c} </p> <p> <u> <b>Comments for Approval : </b> </u> {!relatedTo.Comments_For_Approval__c} </p> <p> <u> <b> Payment Method </b> </u>: {!relatedTo.Payment_Method__c} <c:QuoteEmailTemplate4 theQuoteId="{!relatedTo.Id}"/> {!relatedTo.Number_Of_Installments__c}, <u> <b> Payment Notes : </b> </u> {!relatedTo.Payment_Notes__c} </p> <p> <u> <b> Payment Notes in English : </b> </u> {!relatedTo.Payment_Note__c} </p> <p> <u> <b>Payment Type : </b> </u> {!relatedTo.Payment_Type__c } </p> <p> <u> <b> Special Instructions :</b> </u> {!relatedTo.Special_Instructions__c} </p> <p> <u> <b> Obligation : </b> </u> {!relatedTo.Obligation__c} </p> <p> <u> <b> Amount for the Obligation : </b> </u> {!relatedTo.Amount_for_the_Obligation__c} </p> <table BORDERCOLOR="blue" style="solid"> <tr> <th bgcolor="blue"> <font color="#fff"> <b> Product Name</b> </font> </th> <th bgcolor="blue"> <font color="#fff"> <b> Part/KIT Code</b> </font> </th> <th bgcolor="blue"> <font color="#fff"> <b> List Price</b> </font> </th> <th bgcolor="blue"> <font color="#fff"> <b> Quantity</b> </font> </th> <th bgcolor="blue"> <font color="#fff"> <b> Sales Price</b> </font> </th> <th bgcolor="blue"> <font color="#fff"> <b> Total Sales Price</b> </font> </th> <th bgcolor="blue"> <font color="#fff"> <b> Line Discount </b> </font> </th> <th bgcolor="blue"> <font color="#fff"> <b> GM</b> </font> </th> <!-- <th bgcolor="blue"> <font color="#fff"> <b> Target Price </b> </font> </th> <th bgcolor="blue"> <font color="#fff"> <b> Discount from Target price </b> </font> </th> --> </tr> <apex:repeat var="item" value="{!relatedTo.QuoteLineItems}"> <tr> <td bgcolor="#E2E1E1" text="alignright;"> <p>{!item.Product2.Name} </p> </td> <td bgcolor="#E2E1E1">{!item.Part_KIT_Code__c}</td> <td bgcolor="#E2E1E1">{!item.VF_Total_Line_List_Price__c}</td> <td bgcolor="#E2E1E1">{!item.Quantity}</td> <td bgcolor="#E2E1E1"> {!item.VF_Sales_Price_After_Discount__c}</td> <td bgcolor="#E2E1E1"> {!item.VF_Total_Sales_Price__c}</td> <td bgcolor="#E2E1E1"> {!item.Line_Discount_Calculated__c} </td> <td bgcolor="#E2E1E1"> {!item.QLI_Gross_Margin__c} </td> </tr> </apex:repeat> </table> <p> <u> <b> Opportunity Currency :</b> </u> {!relatedTo.Opp_Currency__c} </p> <p> <u> <b> Total Deal :</b> </u> {!relatedTo.VF_TotalPrice__c} </p> <p> <u> <b> Customer Discount :</b> </u> {!relatedTo.Customer_Discount__c}% </p> <p> <u> <b> Internal Discount :</b> </u> <c:QuoteEmailTemplate1 theQuoteId="{!relatedTo.Id}"/>*(after target,promotion) </p> <p> <u> <b> Gross Margin :</b> </u> {!relatedTo.Quote_Gross_Margin__c}% </p> <p> <u> <b> Billing Address : </b> </u> {!relatedTo.BillingStreet}, {!relatedTo.BillingCity}, {!relatedTo.BillingState}, {!relatedTo.BillingCountry}, {!relatedTo.BillingPostalCode} </p> <p> <u> <b> Shipping Address : </b> </u>: {!relatedTo.ShippingStreet}, {!relatedTo.ShippingCity}, {!relatedTo.ShippingState}, {!relatedTo.ShippingCountry}, {!relatedTo.ShippingPostalCode} </p> <p> <u> <b>For further info on the quote </b> </u>: <a href="https://syneron-candela.my.salesforce.com/{!relatedTo.Id}">Link</a> </p> <p> <u> <b> Please approve or reject using one of the following options </b> </u> : </p> <p> <b> 1. Through the approval request page: </b> </p> <a href="https://Test.my.salesforce.com/home/home.jsp"> Home Page </a> <p> <b> 2. Reply this mail with the one of the following key words: </b> </p> <p> <b> Approve / Approved / Reject / Rejected / Yes / No </b> </p> <p> <b> Thank you, <c:QuoteEmailTemplateOppOwnerName theQuoteId="{!relatedTo.Id}"/> </b> </p> </body> </html> </messaging:htmlEmailBody> </messaging:emailTemplate>
To solve this and avoid the error message, you need to code the component controller to handle null values for all inputs in a graceful way (that is, assume all inputs can be null - check for null, and handle accordingly without throwing exceptions)
For example - the most likely cause of the NPE is that currentInteractions is null because the setter for it was never invoked. Thus rewrite this method to:
Thanks for the reply. The below is the Code for the Controller of the Component. Request you to please help me know what changes to be made in the below code :
Thanks for any Help in Advance...!