1

Say that we have a Number field called Quote. In the email template, we want to force it to have two decimal numbers.

For example, if it is 4, we want to display 4.00. However, it is an html email template not a Visualforce one so I can't use controller.

And tried to use a formula field to convert it into text via:

text( floor( My_Number__c ) ) + "." + right( text( ( 1 + My_Number__c - floor( My_Number__c ) ) * 100 ), 2 )

However, since Quote__c itself is a formula field this new formula exceeds character limit by Salesforce.

Is there any way I can walk around this issue?

1 Answer 1

2

This works for me at my DE, not sure if this formula exceeds your limit or not.

LEFT(TEXT(My_Number__c * 1.001),LEN(TEXT(My_Number__c))+3)
3
  • I am still getting the same result. It shows something like 4 instead of 4.00
    – Lance Shi
    Commented Jun 5, 2018 at 11:35
  • check my updated answer, it works for me Commented Jun 5, 2018 at 12:30
  • Thank you for this. It can work if the digits in the original number is less than 4. But I would argue that it won't work for scenarios which have more than 4 digits. Interesting solution though
    – Lance Shi
    Commented Jun 5, 2018 at 23:01

You must log in to answer this question.

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