function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
aparkmanaparkman 

Merge field error in HTML email template

I'm new to Visualforce and trying to make a Visualforce email template. I'm trying to make an email template that list some information about the Pricing Request (Parent Object), but also lists all of the Price Adjustments (Child Object) within it. All of the HTML is correct, but I'm having big problems with merge fields within it. I put the same merge fields that are in the regular email templates, but keep getting errors with them,

 

error message reads " Error: Invalid field Price_Adjustment__c for SObject Pricing_Request__c"

 

This is the part of the code that is supposed to put the data into the table

 

<apex:repeat var="pa" value="{!relatedTo.Price_Adjustment__c}">
<tr>
<td>{!pa.Product__c}</td>
<td>{!pa.Brand_Group__c}</td>
<td>{!pa.Brand__c}</td>
<td>{!pa.Flavour__c}</td>
<td>{!pa.Format__c}</td>
<td>{!pa.Size__c}</td>
<td>{!pa.Pack__c}</td>
<td>{!pa.Rebate__c}</td>
</tr>
</apex:repeat>

 

Any idea why I'm getting that message?

 

Thank you,

Adam

Sgt_KillerSgt_Killer

You are trying to access the values of Price Adjustments(Child) from the Pricing Request(Parent). Two ways of accessing your Parent record related to the Child record are

 

1. Ensure that your email template is based on the Child object and try accessing the related parent object.

2. If you are using VF email template, try to use Custom Controllers to display the related records.

 

 

With Regards,

Sgt_Killer


aparkman wrote:

I'm new to Visualforce and trying to make a Visualforce email template. I'm trying to make an email template that list some information about the Pricing Request (Parent Object), but also lists all of the Price Adjustments (Child Object) within it. All of the HTML is correct, but I'm having big problems with merge fields within it. I put the same merge fields that are in the regular email templates, but keep getting errors with them,

 

error message reads " Error: Invalid field Price_Adjustment__c for SObject Pricing_Request__c"

 

This is the part of the code that is supposed to put the data into the table

 

<apex:repeat var="pa" value="{!relatedTo.Price_Adjustment__c}">
<tr>
<td>{!pa.Product__c}</td>
<td>{!pa.Brand_Group__c}</td>
<td>{!pa.Brand__c}</td>
<td>{!pa.Flavour__c}</td>
<td>{!pa.Format__c}</td>
<td>{!pa.Size__c}</td>
<td>{!pa.Pack__c}</td>
<td>{!pa.Rebate__c}</td>
</tr>
</apex:repeat>

 

Any idea why I'm getting that message?

 

Thank you,

Adam