5

I want to display the currency field with all the decimal places.Right now salesforce automatically rounds it to two decimal places. salesforce displays 123.45678 as 123.46 ,i want it to be 123.45678 on the detail page,it displays as 123.45678 on edit page.Is there any way to do it?!

enter image description here

5

Take a look at the docs on apex:outputText. You can use the Java MessageFormat format strings.

For example, the following will display US currency with six decimal places, formatted with comma separators, up to 999 trillion dollars and will always show six digits to the right of the decimal place due to the zeroes. This is Visualforce, though.

<apex:outputText value="{0, number, $###,###,###,###,##0.000000}">
    <apex:param value="{!myObject.My_Value__c}"/>
</apex:outputText>
| improve this answer | |
2

enter image description here

enter image description here

You can specify the decimal values for the field as shown in above screenshot

| improve this answer | |
  • I had declared it with 6 decimal places,but on saving the record it rounds it to 2 decimal places.I dont see any image in your post – Keepcalmncode Oct 24 '12 at 14:11
  • 1
    Is your page a visualforce page or a simple standard detail page ? – Mohith Shrivastava Oct 24 '12 at 14:13
  • As you can see i did a demo in my developer and its working to display all the digits as i want – Mohith Shrivastava Oct 24 '12 at 14:23
  • I've verified @MohithKumar 's solution in my Dev Org; created a new custom currency field with 6 decimal places and it displayed as expected (currency locale set to US.) – Mike Chale Oct 24 '12 at 17:00
  • I want to display all the decimal on the standard detail page. – Keepcalmncode Oct 25 '12 at 5:41
2

Currency fields are formatted according to the record's currency (ISO code) and the org currency setup (Company Profile - Manage Currencies).

You have several options:

  1. Change the number of decimal places for the currency as a whole (perhaps unlikely that this will be what you want - as this will change the formatting of all currency values everywhere for that currency)

  2. Change the type of your field from "currency" to "number"

  3. Add a formula field where the output type is number and is set to 6dp, where the formula simply references your existing currency field

| improve this answer | |
0

I have modified the currency settings under the manage currencies section.

| improve this answer | |
  • 1
    I have just updated my answer relating to this option - this will change the formatting of EVERY currency field when using this currency – Stephen Willcock Oct 26 '12 at 8:07
  • If my answer guided you please mark the answer - thanks :-) – Stephen Willcock Oct 27 '12 at 12:28

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.