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 am trying to deploy a couple of formula fields from sandbox to production but I am receiving this error:

The formula references fields across 11 relationships while only 10 are allowed.

Now I know for a fact this is not the case. The formula is very simple on traversing one level deep. There is a lookup field on the object. I am using that relationship to display a field from that object via a formula field. So basically it looks like this:

Custom_Object__r.Custom_Field__c

I have this issue with two formula fields. Any ideas why I am getting this error while moving to production?

Also using the Force.com Migration Tool

share|improve this question

3 Answers 3

there is a limit of 10 unique relationships for cross-object merge fields. You can reference any number of merge fields across one relationship (i.e., from Contact you can reference as many Account fields as you want), but if you try to reference a merge field across a 6th relationship, then you will be blocked from saving that formula.

Basicly relationships in this case does not mean how many object deep you go to get value but from how many objects formula fields from your object can get value

share|improve this answer

Echoing @Birthus but with an additional wrinkle:

Since you didn't report the error in sandbox, it is possible that you started with 10 cross-object relationships from your object Foo to other objects: obj1__r.xxx, obj2__r.yyy, ...obj10__r.zzz then you deleted one of the obj1 ... obj10__r and added an eleventh relationship obj11__r.www. Your sandbox won't complain.

This can be challenging at deployment time as the addition of the 11th and the processing of the delete of one of the first ten doesn't happen in the same sequence as you expect. I believe this is because the field that was deleted referring to the 1-10th relationship needs to be Erased from the PROD org before you can deploy. I know when faced with this before I had to first get down to 9 relationships before adding my tenth - hence a two step deployment.

That said, an easier way out if you can wait, is to file a support ticket with SFDC who I believe can increase the limit to 15 from 10 (cross object relationships)

share|improve this answer
    
So the thing is that I am adding all new custom field to an untouched lead object. So if I am just mimicking what I did in sandbox it should just work –  user2308453 Mar 7 at 3:50
    
Hmm, let's go back to first principles - does your formula field refer to 11 different cross-object relationships; e.g. does it use 11 different lookup relationships? Does the formula refer to other lead fields that in turn do cross object relationships? Is the error occurring on your specific formula field or is it reported at the Lead level? Does the PROD version of Lead have admin-added cross-object fields that are not present in your sandbox? –  crop1645 Mar 7 at 16:09

The limit is per object, so you must have a number of other formulas that also reference cross-objects. You must not have all the other formulas in your sandbox.

To find out what other formulas you have that are referencing cross-objects, try creating the formula manually in production. When you get the error, you will also get a link to show you all the other references. That's the only way I know how to find them easily.

(I also agree with crop1645 - you can contact support to get a limit increase)

share|improve this answer

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.