I've encountered a common error on Case but am having some trouble understanding exactly what it is that is causing it, is it previous related object references in other formulas, validation rules, workflow rules or is it only the Related Object References within the current formula, validation rule or workflow that are surpassing 20

Here is a screenshot of the error

Spanning Relationship Error

In my mind I am only spanning one or two relationships (agent contact is just a lookup to Contact), far from 20, so I assume previous Related Object References is causing the issue. However reading the Salesforce Documentation it seems to really only touch on the error being caused by the current Formula/Validation Rule/Workflow rule you are writing. Anyone experienced this before and has any insight? I've already written the validation rule in Apex so i'm not necessarily looking for a workaround per se but more on how the 20 spanning relationships are reached


The error is a per-object error. You can't reference more than 20 objects across all formulas combined on an object. The help topic you're linked is worded oddly, which is not entirely surprising. KB articles are submitted by Support employees, not the Documentation team or anyone with more official capacity, and may contain errors or odd wording, and tend to become outdated over time, as they are not meticulously curated as the more official documentation.

  • Makes sense, I couldn't find any Salesforce official documentation on the issue so thats what I was going off of. So even though the two objects I am referencing is Contact and Account, which i've referenced before, it is double counting them?
    – Bobbygllh
    Jun 12 '20 at 14:20
  • @Bobbygllh No, it should be 20 unique objects/relationships.
    – sfdcfox
    Jun 12 '20 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.