Error: SOQL statements cannot query more than 25 different parent types

  • 2
  • Problem
  • Updated 5 years ago
  • Solved
  • (Edited)
Hello,
In one of my Skuid Page i sm getting below error can someone explain me the reason for this error
SOQL statements cannot query more than 25 different parent types.
An unexpected error has occurred. Your solution provider has been notified. (skuid)

Please tell me the solution for it as it is too frustrating.

Look for an quick solution.

Thanks.
Arpit
Photo of Arpit

Arpit

  • 1,514 Points 1k badge 2x thumb

Posted 5 years ago

  • 2
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,014 Points 20k badge 2x thumb
Hello Arpit,

There is a SOQL limit that prevents you from referencing more than 25 unique parent object types across all of your reference fields. You can have up to 25 custom lookup fields, I believe, but I think that other standard reference fields, such as OwnerId, CreatedById, LastModifiedById, ParentId, will contribute to this limit as well, so if you were querying for Object1Lookup__c, Object2Lookup__c, Object3Lookup__c, ..., Object25Lookup__c, and all of these pointed to a different parent object type, and none of these point to the User object, and then you are ALSO querying on one of the other standard fields, such as OwnerId, then you would exceed the 25 unique reference fields limit.

If you can post the page XML we may be able to better diagnose the cause of the problem.

Regards,

Zach
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,014 Points 20k badge 2x thumb
Arpit,

A quick solution would be to split up your 31 Lookup fields across several Skuid Models --- that way you will be running multiple SOQL queries and will get around the "25 different parent types" limit. Just create a copy of your current model, call it something like "Model2", and then add in some of your Lookup fields into this Model and take them out of the other Model. This will also require you to change the Model of your Field Editors that are showing these Lookup fields, but this should be a good solution.

Zach
Photo of Arpit

Arpit

  • 1,514 Points 1k badge 2x thumb
Thanks Zach. It Worked!!! :)