You need to sign in to do that
Don't have an account?
Rick Stocker 8
VisualForce Email Template: Formula field not populating
I have a 3,000 character formula field (Text) on Opportunity with nested IF statements to select and display an address based on information from related records. The BR() tag is used to force new lines in the output. It works perfectly as shown via a Report - always populated correctly.
I've incorporated the field for display in a VisualForce email template using the following syntax.
<apex:outputField value="{!relatedTo.Invoice_Address_Formula__c}"/>
On testing using "Send Test and Verify Merge Fields" the result is always blank. I have successfully substituted the failing formula field for others. I have also reduced the formula to just one IF statement and found the result was visible.
I can't find any reference to limitations on the size or structure of a formula field when displaying it in a Visualforce email.
Can anyone shed light on why this failure has occurred?
I've incorporated the field for display in a VisualForce email template using the following syntax.
<apex:outputField value="{!relatedTo.Invoice_Address_Formula__c}"/>
On testing using "Send Test and Verify Merge Fields" the result is always blank. I have successfully substituted the failing formula field for others. I have also reduced the formula to just one IF statement and found the result was visible.
I can't find any reference to limitations on the size or structure of a formula field when displaying it in a Visualforce email.
Can anyone shed light on why this failure has occurred?
Not sure what is wrong with your formula but as you said you could get if you reduce one if statement, then try to split your formula into two fields.
Please refer below post
https://help.salesforce.com/apex/HTViewSolution?urlname=Formula-field-exceeds-maximum-number-of-characters-1327109401516&language=en_US
https://help.salesforce.com/apex/HTViewHelpDoc?id=formula_field_limits.htm
http://resources.docs.salesforce.com/204/5/en-us/sfdc/pdf/salesforce_formula_size_tipsheet.pdf
Hope this helps you!
Please accept my solution as Best Answer if my reply was helpful. It will make it available for other as the proper solution.
Thanks and Regards
Sandhya
Thanks for your suggestion, but I don't believe that the issue lies in the structure of the formula.
The formula itself works perfectly in reports, page layouts and when the field is exported via the Data Loader. The problem only exists when trying to display the formula field in a Visualforce Email Template.
I'm hoping for some advice on Visualforce (Email Templates) - particularly if there are restrictions on formula size, or if other different commands/syntax are needed, or if a controller is needed to pre-query the records.
Rick