When creating text fields in Salesforce, you have several options:
- Text
- Text Area
- Text Area (Long)
- Text Area (Rich)
- Text (Encrypted)
For all options except for Text Area, you have a choice of how long you want the field to be.
For the basic text field, I generally follow this approach:
- If it stores a “yes” or “no” answer, length is 3
- If it stores a record id, length is 18
- For basically everything else, length is 255 (the max)
This is because there’s no meaningful difference between text(100) and text(255). So you might as well put the maximum.
Note that this logic doesn’t apply to the other text fields. With a long text area, there is a meaningful difference between 32,768 (the default) and 131,072 (the maximum). So only put a size that makes sense to your use case.
The takeaway
With basic text fields you can be greedy with the length. For all other text fields, be conservative.
Category:
Salesforce