Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers

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.

share|improve this answer
    
Thanks for the suggestion. I'm working through the permutations now. At this stage it appears that marking them Inactive will be sufficient. –  Daniel Ballinger Mar 1 '13 at 1:22
add comment
up vote 1 down vote accepted

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.

share|improve this answer
    
nice work, quite the study!! –  Ralph Mar 2 '13 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. –  Daniel Ballinger Mar 7 '13 at 1:31
    
Lol, the upvote is cool with me, you're answer was the most complete –  Ralph Mar 7 '13 at 1:55
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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