Please declare a unique Child Relationship Name! Think of it as just as important as the Related List Label (which is what your Salesforce users see). The Child Relationship Name is what developers see when writing sub queries in Apex. Salesforce uniquely names Child Relationships if you don’t. However, those names are generally useless for developers trying to fully understand the relationship if there’s more than one Child Relationship from the given object.
I’ve encountered this issue on several clients’ orgs. Recently, one I worked on had multiple Lookup fields on the Account object relating back to the Account object. While this is okay to do, make sure to name the Child Relationships appropriately. Here’s an example of what they had for one of their Lookups:
Looking further into the schema on the Account object, we see three other child relationships from Account (and coincidently “to Account” in this example):
A simple refactor to something like a “
indentifierSObject” pattern would be better choice.
So instead of:
We end up with something like:
SFDC will limit the number characters in the Child Relationship Name, so figure out what communicates best.
This will make all future developers of the codebase much happier.
Happy clouds ~~~