11 August 2012

You have reached the maximum number of 10 object references on Child


The error "You have reached the maximum number of 10 object references in <Object Name>" refers to the maximum number of unique relationship name you can refer to using formula fields meaning the '__r' on the formula.

For example I created 11 lookup fields on the same object. I named it Parent__c, Parent_2__c ... Parent_11__c and want to reference a field on that object for all lookup fields.

This won't be possible as I can only create up to 10 relationship formula fields for these lookup. Trying to create a formula for Parent_11__r will give an error similar to the below: 



So what's the solution?

If you want to populate the hypothetical field Parent_External_ID_11__c (not displayed above) you need to:
  1. Ask salesforce to increase it.  You can request to increase it up to 15 as of summer 12. See notes from product manager and consequence. http://success.salesforce.com/ideaView?id=08730000000gKsbAAE
  2. Remove unused formula fields if possible.
  3. Convert the field to its appropriate field type (in this case I'm just referencing a text so I need to change the field to Text) and then create an Apex Trigger to populate field on the before or after update event as needed.
Please note that you cannot use workflow rule and field update formula if you are referencing the same relationship because its also counted against the limit.