I am new to email templates and I have a value {!relatedto.RST_Amount__c} that only displays 1 decimal point when sending an email.

The way I usually fix this is by doing a .toFixed(2) with javascript, however I am not sure how I can update my outputLabel (or any other suggested field) with a javascript

What I have tried:

function toFix()
  var x - document.getElementByID('test1');
  var value = x.innerHTML.toFixed(2);
  x.innerHTML = y;
<apex:outputLabel value="{!relatedto.RTS_Amount__c}" id="test1"/>

With visalforce emails I cannot to an onload="toFix()" it seems on the

I am at a loss for the moment, any help would be greatly appreciated.

1 Answer 1

<apex:outputText value="{0,number,#,##0.00}">
<apex:param value="{!relatedto.RTS_Amount__c}" />

Use outputtext with apex:param and you should be good with above code.

  • Thanks for the quick feedback Mohith, I get an error when using your suggestion Error: The value attribute on <apex:outputText> is not in a valid format. It must be a positive number, and of type Number, Date, Time, or Choice.
    – jnoel10
    Commented Oct 16, 2013 at 14:49
  • RTS_Amount__c this is of what data type.I mean field Commented Oct 16, 2013 at 14:50
  • I am sorry, could you edit your answer it is still unclear for me.
    – jnoel10
    Commented Oct 16, 2013 at 14:51
  • I am sorry too.I assume your RTS_Amount__c field is a currency or number or decimal ?I just want to know the datatype of this field so that i can help.Thanks Commented Oct 16, 2013 at 14:54
  • it is of type currency
    – jnoel10
    Commented Oct 16, 2013 at 14:55

You must log in to answer this question.

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