1

When we add a Custom field of these data types 'Currency field/ Number field/Percent' as merge fields on email template or adding the merge field on a document, trailing zero's are removed. Trailing zeroes are ignored in both tenths place and hundredths place (e.g. $50.00, $1.10 will display as $50 and $1.1 respectively.)

Any suggestions on how to print the value without trimming '0's. (e.g: $50.00 and 1.100 % should be printed as $50.00 and 1.100 respectively)?

2
  • Thanks for reply, Actually the requirement is to print the field on Word document. So backend is ignoring zeroes as mentioned, and not finding a way to get the exact value or to format field without trimming zeroes. Somehow we need a way to read the field decimal values(16,2 or 18,0) so we can append trimmed zeroes back in JS controller. Dec 24, 2019 at 6:20
  • You should search for Word merge field formatting, it seems very straightforward. Dec 24, 2019 at 17:50

1 Answer 1

0

I'm afraid this is a bug with templates as Standard fields render properly and custom render trimmed.

You can try using Visualforce Email Templates instead —note you can only send those to either a User, a Contact or a Lead.

Here's an example on how you could render a custom field:

<messaging:emailTemplate subject="Your email subject" recipientType="Contact" relatedToType="Opportunity">
  <messaging:htmlEmailBody >
    Your email letterhead and other content...
    <apex:outputText value="{0, number, ###,###,###.00}">
      <apex:param value="{!relatedTo.Number__c}" />
    </apex:outputText>
  </messaging:htmlEmailBody>
</messaging:emailTemplate>

Not the answer you're looking for? Browse other questions tagged .