What is the Best Practice to display number field without a thousands separator (comma or period, depending on locale)?
I have rejected the following ideas:
- Text field, because I have to write Validation Rule for number. Performance will be affected.
- Phone field, because in case of editing in UI, Salesforce changes 10 digit numbers to match US formatting.
I am looking for best practice, because no clean solution is available. All are dirty solutions.
- There is no decimal
- I won’t use the field on VF pages; I’ll use the field in reports, and hence don’t want the comma in my report tab – if the comma isn’t there on the report tab, it won’t reflect in the downloaded XLS too
Create a new custom field, where type is “formula” and the formula return type is “text”.
In the formula, use the TEXT() function, and pass the existing number field value into this formula. For example, if your number field is MyNumber_c then your formula would be: TEXT( MyNumber_c )
Your users will enter values into the existing number field, but you can use the formula field (which doesn’t display thousands separators) in reports, list views etc.