When trying to install an update for a managed package that I created into a clients Org the install failed with the message:

The first validation error encountered was "{0}"

Problem - Validation Errors While Saving Record(s)

Detail - There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "{0}".

How can I determine what caused this validation error and subsequent install failure? The detail message doesn't provide many clues.

The changes between this newest version and the previous one where mostly around the addition of new Validation Rules on Opportunity. The "{0}" in the details looks like the part where I should see some useful information, but the substitution hasn't occured.

I have raised this as a support case, but there is a 2 day wait before I get past the first level of support. I also created Package install fails - The first validation error encountered was "{0}" on the discussion boards.

Update 1

After trying to install the validation rules manually into the target Org I ran into the following error message when saving the 6th of 7 total rules in the managed package.

"The formula references fields across 11 relationships while only 10 are allowed. Please contact support at salesforce.com for more assistance"

I had seen this before when trying to add additional validation rules in the managed package. When using the Check Syntax button I get the slightly clearer message:

"You have reached the maximum number of 10 object references on Opportunity"

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

They have 5 formula fields already in place with related object references and the managed package I'm trying to install has 6 validation rules. If this is indeed the reason the managed package can't install then it would appear the object reference limit isn't independent in a managed package.


2 Answers 2


Re: "The formula references fields across 11 relationships while only 10 are allowed. Please contact support at salesforce.com for more assistance"

This is a "soft" limit, that is salesforce support has the ability to raise this limit within reason. I've seen it raised to 12 without any pushback before. I believe anything over 15 requires additional approvals from the product management team.

The limit is in the number of related object fields you are referencing. For example the formula:

myCustomLookup__r.name && account.name

would consume two "relationships" in terms of this limit as it follows the account and myCustomLookup__c fields.

After resolution notes

Some notes from the support case in the customers Org that got the limit increased after 12 hours with Premier support and several levels of esculation:

  • I need assistance with CRM
  • Product Topics Limits & Feature Activations
  • Subject Increase Spanning Relationships limit (Note that Support changed the subject to this)
  • Excerpt from Case Comments: "I am glad to inform you that the requested limit has been increased to our hardcoded maximum of 15 for your organization."
  • Am I correct that the managed package doesn't get its own independent limit for the object relationships? Aug 7, 2012 at 22:50
  • 1
    You are in fact correct! Schema limitations like this are not per-namespace but are instead per-object. Aug 7, 2012 at 22:52
  • Perfect, thanks. I'll bring that up in the support case to see if they can improve the error message during package install. Aug 7, 2012 at 22:57
  • Mention that other ISVs have hit this very same error before! You can reference case #07895422 for the last time I saw it. Aug 7, 2012 at 23:00
  • 1
    I found a reference to the specific feature in question: Formulas: Number of Unique Relationships Per Object Aug 7, 2012 at 23:30

I assume you've run all tests on the code in your development org? If that's all working ok, it would suggest that some validation rules in your package are potentially affecting test methods that are in the target org already.

If there is other custom code in there which has test coverage inserting opportunities, then I believe those records would be subject to your validation rules, so you may need to modify your rules to make them more lenient, maybe checking record types or similar to only validate specific records.

  • Just reran all the test cases in my development org and they passed. Also, the package just installed successfully into another separate developer org. I'll explore temporarily putting the Validation rules into the problem sandbox org manually and seeing what breaks. Thanks. Aug 7, 2012 at 3:53
  • 1
    If you've got administrator access to the sandbox in question it might be worth running the tests that are in there too just to see if they pass without your package.
    – Matt Lacey
    Aug 7, 2012 at 3:54
  • 1
    They have test failures in their Org prior to the package install. I think I'll work through those with them first. It may be sometime before I get to try the package install again. Aug 7, 2012 at 4:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .