• QueOra
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

I am running a series of queries to provide audit data to a client who wants on-demand snapshots of all the fields on a set of related objects. Everything runs fine except that for one object I receive 'System.UnexpectedException: Query is either selecting too many fields or the filter conditions are too complicated.'

 

The queries are all identical in structure and very simple (ie SELECT field 1, field2, ... fieldn FROM object WHERE Related_Object_Id = Id.) What is really odd is that the object we have this error with is NOT the largest object we are reporting on (by about 20%). SInce these queries are built dynamically using Schema.SObjectType.<object_Name>.fields.getMap(), trimming out columns would be messy, not to mention contrary to the clients needs.

 

Any ideas of why this could be happening? And what I can do to fix it? Is there a documented limit on the number of columns allowed in a query?