1

I'm hitting a "Custom Relationship Limit Exceeded" error on the Account object, but I'm not really sure how to identify the existing relationships so that I can clean them up.

For example, I pulled all of the lookup fields, but the count is under the limit (37) -- is there a simple way to identify which ones I'm missing?

2 Answers 2

2

If you want a quick script to see just the custom relationships, you could run something like the below in Execute Anonymous:

DescribeSObjectResult accountDescribe = SObjectType.Account;
for (SObjectField field : accountDescribe.fields.getMap().values())
{
    DescribeFieldResult fieldDescribe = field.getDescribe();
    if (!fieldDescribe.getReferenceTo().isEmpty() && fieldDescribe.isCustom())
        system.debug(field);
}

system.debug('\n');

for (ChildRelationship relation : accountDescribe.getChildRelationships())
    if (relation.getField().getDescribe().isCustom())
        system.debug(relation);
2
  • Thanks! I executed this and it gave me what looks like two separate sets of fields (parent and child I'm guessing?) The former there's only 31, but the latter there's 107, which would explain hitting the limit, but how would SFDC have even allowed us to get that far over the limit of 40?
    – Matt
    Jan 12, 2017 at 18:56
  • The latter list is of child relationships, of which I'm not sure there is a limit. As for the former, I would open up a case with support to address the discrepancy.
    – Adrian Larson
    Jan 12, 2017 at 18:59
1

You can install free Etherios EasyDescribe - Free MetaData Viewer/Extractor product to find the relationships.

The results can also be exported to excel.

It will look like this:

Child relationship

You must log in to answer this question.

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