Our application Ring My Bell displays a message using a public double property in the controller which is displayed in a message using <apex:outputText>:

<apex:outputText value="{!person} just closed an Opportunity worth ${0,number,###,###,###,##0}!" rendered="{!NOT(seen)}">
    <apex:param value="{!amount}"/>

The value in amount is 0 if the value in the record is null, otherwise it takes on the value from the record. This works perfectly (as it should!) for every customer except for one... they're seeing the actual merge field in the message on screen:

Error on screen

He did say that amount field on the opportunity is calculated on update via a workflow. A trigger I wrote copies the opportunity amount to a custom object field which is what ultimately ends up on screen. I've tried reproducing his setup and can't get the error to happen. Setting amount to null in the controller just results in no number in the message, and remove field access does the same.

I've never seen this in over 3 years of working with the platform and can't find any way to reproduce it. Has anybody seen this before or could it be a weird platform bug related to this user's particular setup?

  • 1
    It's a long shot, but try adding name and/or ID attributes to your apex:param tag. Vague recollection of odd behavior when missing those attributes. Other than that, looks like a bug - the message format source should NEVER make it to the UI.
    – jkraybill
    Apr 3, 2013 at 1:27
  • Can you change amount to feed off of a currency field instead and use the built-in type formatting of <apex:outputField />? Apr 3, 2013 at 1:49
  • 3
    I've seen this sort of behaviour before with String.format() and single quotes. I could see the same thing happening with outputText. I'd look for a single quote in person. Apr 3, 2013 at 2:18
  • 2
    My bad, using a string property and not calling escape single quotes on it. Daniel if you want to write that up as an answer I'll declare you world champion :)
    – Matt Lacey
    Apr 3, 2013 at 3:32
  • 1
    Glad to help. It shows the benefit of writing these things down and being able to Google myself for something I vaguely remembered from 2 years ago. Apr 3, 2013 at 5:27

1 Answer 1


As per my comment, I've seen this sort of behaviour before with String.format() and single quotes in the string formatting argument. See APEX String.format(); Syntax - escaping single quotes.

The unprocessed output your seeing with outputText seems very similar. I'd look for a single quote in value of !person.

With the benefit of hindsight now that you've confirmed that is is the case it makes more sense. {!person} is being substituted directly into the value and the {!amount} is being formatted in via a param. So half way through the substitution is more like:

> value="John O'Connor just closed an Opportunity worth ${0,number,###,###,###,##0}!"

As you found, escaping this single quote will resolve this issue. Another alternative would be using a param for person as well.

This site is temporarily in read-only mode and not accepting new answers.

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