0

I am trying to create a new field on "Case" but I get the following error: "You have reached the maximum number of 15 object references on Case. You must remove at least 6 relationships(s) in order to save this Formula Field. Related objects referenced in this Formula Field:

  • Account
  • Account.---
  • Account.--- (10 fields)"

My question is why I am getting this error when I am using only 10 object references and not 15. What will be the workaround for it, just in case this is not allowed by Salesforce?

  • THis is a known issue. There is a limit on the number of object references used in validation rules, formula fields , workflows etc. The other alternative is to do the task using the triggers. – Suresh Apr 29 '15 at 17:02
3

It's a little hard to tell what your actual object references are from what you've pasted in your question, but:

The count is based on the number of unique relationships referenced in formulas in the following components on an object:

  • formula fields
  • workflow rules and field update actions
  • approval processes
  • validation rules
  • assignment rules
  • escalation rules
  • auto-response rules
  • quick action predefined values

Each record traversal is one unique relationship. For example, if all of the following fields were referenced in any of the above components on the Case object, it would have 13 unique relationships:

  • AccountId -- 0 relationships; these types of standard fields do not require an object traversal
  • Account.Id -- 1 relationship (Case-Account)
  • Account.CreatedBy.LastName -- since the Case-Account traversal has already been done, this is only 1 additional relationship (Account-User)
  • Parent.CaseNumber -- 1 relationship (Case-Case), since it’s a different record
  • LastModifiedBy.Profile.CreatedBy.Profile.Name -- 4 unique relationships (User-Profile-User-Profile)
  • CreatedBy.Profile.CreatedBy.Profile.Name -- also 4 unique relationships, since even though it’s User-Profile-User-Profile again, it’s traversing a different set of records
  • Contact.Account_Id__c (a hypothetical custom formula field on the Contact with a value of “Account.Id”) -- 2 unique relationships on the Case object, and 1 unique relationship on the Contact object
  • $User.ProfileId -- 0 relationships; global merge variables don’t count as an object traversal

If you have hit the limit, here are suggestions to free up some of your references:

  • Consider if there are other ways to expose data in formula fields. For example if you want to see information on an object 1-2 levels away on an object’s detail page but not report on it, you can require users to hover over the lookup link to view the details.
  • If you have multiple references to the same type of object (for
    example, you reference four different contacts in formula fields,
    each with a different purpose), consider creating a junction object
    so you can display the referenced objects in a related list.
  • If you have references that are only used in validation rules, rewrite those rules as an Apex trigger.
  • If any of the references are used by only one component, convert that to a trigger.
  • If you are spanning multiple levels of a hierarchy such as parent accounts, cases, or a hierarchy of custom objects, see if it’s possible to flatten the hierarchy.
| improve this answer | |
0

From Knowledge Article

Each object has a limit of 10 spanning relationships. When trying to create a formula that is referencing more than 10 objects you may receive the following error message: "You have reached the maximum number of 10 object references on [Object name] You must remove at least 1 relationship(s) in order to save this [Workflow Rule/formula field/..]."

Resolution

Hitting the limit of 10 is a warning sign that the logic is getting too complex for the formula engine. We allow the increase to a hard coded maximum of 15 so that you aren't blocked, but it's an indication it's time to start considering programmatic logic.

As possible workaround please verify if you can apply any of those best practices:

Possible other ways to expose data in formula fields. For example if you want to see information on an object 1-2 levels away on an object’s detail page but not report on it, you can require users to hover over the lookup link to view the details. If you have multiple references to the same type of object (for example, you reference four different contacts in formula fields, each with a different purpose), consider creating a junction object so you can display the referenced objects in a related list. If you have references that are only used in validation rules, rewrite those rules as an Apex trigger. If any of the references are used by only one component, convert that to a trigger. If you are spanning multiple levels of a hierarchy such as parent accounts, cases, or a hierarchy of custom objects, see if it’s possible to flatten the hierarchy.

To have Salesforce.com Support to increase the Maximum Number of Spanning Relationships Per Entity limit on your organization, please take the following steps: 1- Have a System Administrator to log a Case with Salesforce Support

2- Please mark as "feature activation" on the General Application Area On the case description, please specify: Feature requested: Maximum Number of Spanning Relationships Per Entity Organization ID where you want the feature to be enabled (Navigate to Setup > Company Profile > Company Information): I am the system admin in charge of this feature. Limit requested (maximum possible 15):

3- Our Support Team will review the Case and action the request as needed.

Please vote the idea to increase the object references and here is the idea exchange link

| improve this answer | |

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.