5

I have a managed package with a number of Validation Rules on Opportunity that currently involve spanning relationships.

This has become a limitation when attempting to install into various customer orgs as they may already be close to the default limit of 10.

Install failed
Problem: Spanning relationship limit exceeded
Detail: The formula references fields across 11 relationships while only 10 are allowed. Please contact support at salesforce.com for more assistance.

Spanning relationship limit exceeded

In some cases they can get support to increase the spanning relation limit up to 15, but in others they have already reached the upper limit that Salesforce is prepared to allow (See Can the limit of spanning relationships be increased?).

To work around this I'll be moving from Validation Rules to Triggers to enforce the data integrity.

Will marking the Validation Rules as Inactive in the Managed Package be sufficient to reduce the spanning relationship requirement when installing?

Or do I need to modify the error condition formula in the inactive validation rules as well to remove the reference relationship?

2 Answers 2

4

TL;DR - Marking the validation rules as inactive prevents them being countered against the spanning relationships limit during managed package install.
After install they can be activated one at a time until the limit is reached.

Results based on @Ralphs suggestions

Experiment 1: Dev Org with 5 active validation rules on Opportunity. Install managed package with 7 active validation rules on Opportunity

Result: Install fails with 2 Spanning relationship limit exceeded errors

Experiment 2: Dev Org with 4 active validation rules on Opportunity and 1 inactive. Install managed package with 7 active validation rules on Opportunity

Result: Install fails with 1 Spanning relationship limit exceeded error

Experiment 3: Dev Org with 3 active validation rules on Opportunity and 2 inactive. Install managed package with 7 active validation rules on Opportunity

Result: Install succeeds. Attempting to reactive one of the local inactive validation rules gives the message:

Validation Errors While Saving Record(s)
There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "The formula references fields across 11 relationships while only 10 are allowed. Please contact support at salesforce.com for more assistance.".

Experiment 4: Dev Org with 5 active validation rules on Opportunity. Install managed package with 6 active validation rules on Opportunity and 4 inactive.

Result: Install fails with 'The first validation error encountered was "The formula references fields across 11 relationships while only 10 are allowed. Please contact support at salesforce.com for more assistance."'.

Experiment 5: Dev Org with 5 active validation rules on Opportunity. Install managed package with 0 active validation rules on Opportunity and 10 inactive.

Result: Install succeeds. I'm able to manually active the validation rules from the managed package in the client org until the limit is reached.

3
  • nice work, quite the study!! Commented Mar 2, 2013 at 1:49
  • @Ralph There was a bit of work in setting up the test org and creating the managed packages. I did upvote your answer, but it was easier to create a separate answer for my results. Hope you don't mind not getting the green tick. Commented Mar 7, 2013 at 1:31
  • Lol, the upvote is cool with me, you're answer was the most complete Commented Mar 7, 2013 at 1:55
2

Good question, you could try running a quick test:

  1. Inactivate validation rule in your package org
  2. Upload a beta release
  3. Spin up a developer org and max out the spanning relationships
  4. Try to install the beta release

That said, why not just remove the validation rules completely if they've been replaced? If that's a restriction with managed packages, you can just zero out everything. Change the error condition to "false", and change the description and name to indicate that it's obsolete.

It's not scientific, but in my personal experience, expecting Salesforce to not count inactive things would be very optimistic.

1
  • Thanks for the suggestion. I'm working through the permutations now. At this stage it appears that marking them Inactive will be sufficient. Commented Mar 1, 2013 at 1:22

You must log in to answer this question.

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