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?

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)
  • I am still getting the same result. It shows something like 4 instead of 4.00 – Lance Shi Jun 5 '18 at 11:35
  • check my updated answer, it works for me – Santanu Boral Jun 5 '18 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 Jun 5 '18 at 23:01

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.