Enforcing Number Format In Text Field
June 10, 2015 /
Posted in Salesforce Corner
Sample scenario:
Each Contact will be tied with an external Id that is made out of a set of numbers. To keep track of these numbers, you need to create a custom field with either text or number as the field type.
Problem:
If you choose to use the number as the field type, your external Id will end up like this – 1,234,567. But if you choose text as the field type, you might have bad data because it allows alphabet characters.
Workaround:
To overcome this, you can choose to use text field type. However, you will need some validation to avoid users from adding in alphabet value. For example: