function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Wingu1Wingu1 

Visualforce templates - problema with merge field

I'm sending receipts through Salesforce and I'm merging the amount value of an opportunity with the template. I have a problem with the decimals. In Salesforce the amounts show two decimals but in the template only one. I don't know what the problem might be. Any help will be very useful.

 

Thank you 

jdlforcejdlforce

Hey! Why don't you try the outputfield tag? That one will use the same format as in Salesforce.

 

If that doesn't work for you, let me know and I can give you another idea.

 

JD 

Wingu1Wingu1

Thanks JD, we tried this and it didn't work, do you have an alternative way?

 

Thank you 

jdlforcejdlforce

A solution from Salesforce Premier Support.

 

<apex:outputlabel value="{!ROUND((opportunity.Amount/ 1000)*1000, 2)}" /> 

 

JD 

Wingu1Wingu1

Thank you JD, unfortunately this didn't work either...

 

Best!

Carolina 

jdlforcejdlforce

You have to be doing something wrong then. No offence! 

Do you want to paste your code here?

 

JD 

Wingu1Wingu1

This is the part of the code that shows the amount:

 <tr>
    <td width="324" valign="top"><p><strong>Total </strong></p></td>
    <td width="325" valign="top"><p align="center"><strong>${!Opportunity.Amount}</strong><strong></strong></p></td>

  </tr> 

 

Thank you! 

jdlforcejdlforce

Solution 1: 

 

<td width="325" valign="top"><p align="center"><strong><apex:outputField value="{!opportunity.amount}"/></strong><strong></strong></p></td>

 

You might not like how this output if your organization is using multi-currencies.

 

Solution 2: 

<td width="325" valign="top"><p align="center"><strong><apex:outputText>${!ROUND((opportunity.Amount / 1000)*1000, 2)}</apex:outputText></strong><strong></strong></p></td> 

 

Solution 3: 

<td width="325" valign="top"><p align="center"><strong><apex:outputlabel value="{!ROUND((opportunity.Amount / 1000)*1000, 2)}" /></strong><strong></strong></p></td>