Apex Aide apexaide

How long should the text field be?

thegoodenoughconsultant.com· ·Beginner ·Admin ·1 min read
Summary

This content explains best practices for setting the length of text fields in Salesforce. It highlights how basic Text fields can use the maximum length of 255 characters for flexibility, while specialized text areas require careful sizing based on the use case. It offers practical guidance on setting field lengths for yes/no answers, record IDs, and other values to optimize storage and usability. Salesforce professionals can use these pointers to efficiently design data models with appropriate text field lengths.

Takeaways
  • Set length to 3 for yes/no answers in basic Text fields.
  • Use length 18 for Salesforce record ID fields.
  • Default to max length 255 for other basic Text fields.
  • Be conservative with length for long Text Area fields.
  • Adjust long Text Area size based on specific use cases.

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 there9s no meaningful difference between text(100) and text(255). So you might as well put the maximum. Note that this logic doesn9t 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.

Data Modeling & GovernanceSalesforce