Download page Reduce complexity of SOQL statement to avoid errors.
Reduce complexity of SOQL statement to avoid errors
Question or Problem
You see the following error when viewing the standard Opportunity Line Items (Opplineitem object) data set in both the Template Builder and View Data workbook from a button on the opportunity object: QUERY TOO COMPLICATED - Query is either selecting too many fields or the filter conditions are too complicated.
Causes or Possible Causes
Long, complex SOQL statements, such as statements that contain many formula fields, can sometimes result in a QUERY_TOO_COMPLICATED error. The error occurs because the statement is expanded internally when processed by Salesforce, even though the original SOQL statement is under the 20,000 character limit. To avoid this, reduce the complexity of your SOQL statement.
When Composer performs queries on Opportunity Line Items, 3 objects are retrieved: