Each Object in Salesforce is allowed to have upto 15 unique relationships with other objects.
Objects can be related to other objects using a relationship field. When objects are related to each other, user can create formulas that reference fields on the other object. For instance:
- You have a custom object called MyObject1
- You have another custom object called MyObject2
- MyObject1 has a lookup relationship with MyObject2
- When creating formula fields on MyObject1, you can reference fields found on MyObject2
A formula that references a field on another object is known as a spanning relationship.
When creating a formula on MyObject1, you are allowed to reference another object, like this:
LookupMyObject5__r.SaleAmount + LookupMyObject5__r.FinalDiscount / LookupMyObject5__r.Tax Rate
The limit of spanning relationships per object is 15. This means, that an object, can only contain up to 15 different object references.
The count is based on the number of unique relationships referenced in formulas in the following components of an object:
- formula fields
- workflow rules and field update actions
- approval processes
- validation rules
- assignment rules
- escalation rules
- auto-response rules
Please keep in mind if I have Program Approver, Fiscal Approver as both Lookup(User) on any custom object, any formula using these 2 objects will consume 2 spanning relationship although it is on same Object (User)
In case you exceed maximum spanning relationship, you will get an error like this.
You will then have to revisit your formulas and see if it can be optimized.
Ways to Reduce Spanning Relationships