I am trying to decide whether to use Text or AutoNumber for the detail object in master-detail relationship.
What are the considerations that may affect this decision?
Attribution to: Mingyu
Possible Suggestion/Solution #1
Totally depends on what you are trying to do with the detail object. Unless you are using it as purely an attribute storage object, such as yearly company profiles (revenue, employees, etc), I recommend using Text.
The "Name" field gets special treatment by salesforce in that it is automatically indexed, searched upon, and shows up in lookup fields. I personally don't like seeing "X0001958" in the lookup field, since it gives me no clarity as to what it is. The indexing/searching is also a huge benefit since whatever you throw into the Name field is searchable by default.
If your goal is to decrease the number of fields needed for input (say, a date field and a revenue field) then perhaps consider setting Name using a workflow rule that might combine the Parent Name + Date or something along those lines...
Also, another downside to auto-numbers is that they are not always consistent. When you have test classes testing triggers on that object, they will advance the auto-number generator artificially, so you'll get gaps in your number increments.
Attribution to: Nathan Williams
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/33526