Tell me more ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

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

share|improve this question

4 Answers

up vote 0 down vote accepted

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>
share|improve this answer

enter image description here

enter image description here

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

share|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 – Vipul Reddy Oct 24 '12 at 14:11
1  
Is your page a visualforce page or a simple standard detail page ? – Mohith Kumar 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 Kumar 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. – Vipul Reddy Oct 25 '12 at 5:41
show 2 more comments

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

share|improve this answer

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

share|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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.