[SalesForce] Number format string being displayed on Visualforce page

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}"/>
</apex:outputText>

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?

Best Answer

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.