0

I created a visualforce email template that we use with our quote approval process, however some of the merge fields are not showing up on the email when submitted by certain users.

I used to have the same fields on a text version of the template and it works fine. The only thing I noticed that is different is the visual force is sent directly from the user's email, and the text version was sent from Salesforce on behalf of the same user.

Anyone know where this is controlled?

enter image description here enter image description here

`<messaging:emailTemplate subject="Please Review this Quote" 
recipientType="User" relatedToType="Quote">
<messaging:htmlEmailBody >
<html>
    <body>
        <STYLE type="text/css">
            TH {font-size: 11px; font-face: arial; background: #CCCCCC;
                border-width: 1; text-align: center}  
            TD {font-size: 11px; font-face: verdana}
        TABLE {border: solid #CCCCCC; border-width: 1}
        TR {border: solid #CCCCCC; border-width: 1; text-align: right}
        </STYLE>
        <p> Dear {!recipient.name}, </p>
        <p>Please approve the following quote: {!relatedTo.QuoteNumber}.</p>

        ****Totals for Quote**** <br />
Total List Price: &nbsp;  <apex:outputText value="{0, number, currency}"> 
<apex:param value="{!relatedTo.TotalPrice}" /></apex:outputText>  <br />
Total Value of Free Goods: &nbsp;  <apex:outputText value="{0, number, 
currency}"><apex:param value="{!relatedTo.Total_Free_Goods__c}" /> 
</apex:outputText> <br />
Total Actual Cost: &nbsp; <apex:outputText value="{0, number, currency}"> 
<apex:param value="{!relatedTo.Total_Cost__c}" /></apex:outputText><br />
Gross Profit: &nbsp; <apex:outputText value="{0, number, 0.00}%"><apex:param 
value="{!relatedTo.Gross_Margin__c}" /></apex:outputText>  <br /> 
<br />
Promos: &nbsp; {!relatedTo.Promotions__c} <br />
<br />
**Totals for Calculator*** <br />
Calculator Total: &nbsp; <apex:outputText value="{0, number, currency}"> 

Calculator Cost:   Calculator GP:  

***NEW - Calculator Discount =  

Product Description List Price Quantity Subtotal Discount Total Price Free Goods Standard Promo
{!li.Product2.Name} {!li.Product2.Description} {!li.Quantity}

{!li.Free_Good__c} {!li.Standard_Promotion__c} Link to the Quote Dear {!recipient.name}, Please approve the following quote: {!relatedTo.QuoteNumber}.

        ****Totals for Quote****
Total List Price: {!relatedTo.TotalPrice} 
Total Value of Free Goods: {!relatedTo.Total_Free_Goods__c} 
Total Actual Cost: {!relatedTo.Total_Cost__c}
Gross Profit: {!relatedTo.Gross_Margin__c}%

Promos: {!relatedTo.Promotions__c}

**Totals for Calculator*** 
Calculator Total: {!relatedTo.Calculator_Price__c} 
Calculator Cost: {!relatedTo.Calculator_Cost__c} 
Calculator GP: {!relatedTo.Calculator_GP__c}% 

***NEW - Calculator Discount = {!relatedTo.Calculator_Discount__c}% 

[Product] - [Unit Price] - [Quantity] - [Total Price] - [Discount] - [Free 
Goods] - [Standard Promo]
       <apex:repeat var="li" value="{!relatedTo.QuoteLineItems}">
[{!li.Product2.Name}] - [{!li.UnitPrice}] - [{!li.Quantity}] - 
[{!li.TotalPrice}] - [{!li.Discount}] - [{!li.Free_Good__c}] - 
[{!li.Standard_Promotion__c}]        
</apex:repeat>
</messaging:plainTextEmailBody>
</messaging:emailTemplate>`
  • 1
    Please see How to Ask and reduce the OP to the barest essentials -- it seems as if you have specific merge fields not displaying. Assuming the object in question has values for those fields (you can verify in the UI by testing the email template), then if the user that generates the email doesn't have access to those fields, that would be the issue – cropredy Apr 6 '18 at 19:44
0

Can you check the field accessibility of those field for users? If the field is not accessible then it will not show up in template.

  • accessible for the sender or receiver? – SkottyP Apr 6 '18 at 12:18
  • The sender and receiver didn't change...only the format of the email from txt to visualforce. – SkottyP Apr 6 '18 at 12:32
  • it would be easier for us to debug if you can share your code. – Ashish Sharma Apr 6 '18 at 15:39
  • Code is now added. – SkottyP Apr 6 '18 at 21:37
  • Code looks haywire for me. but i would still recommend to check field accessibility of the sending user. Go the particular field and click on Set Field Accessibility and check if the Profile of the sender user is checked. If field access is given then we need to debug the issue – Mitesh Jain Apr 7 '18 at 14:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.