1

We're intermittently receiving a QUERY_TOO_COMPLICATED error when loading data on the lightning:recordEditForm. I see a solution on here for LWC's lightning forms, but haven't quite figured out a way to workaround this issue on an Aura component.

It took me quite a bit of debugging but we're displaying this error from the lightning:recordEditForm's onerror handler. Is there a way we can avoid this issue without trying to remove formula fields? As far as I can tell we don't really have a large amount of fields overall nor do we have that many formulas, though there are several that are complex.

I believe it occurs when we attempt to reload the form after save.

This record could not be loaded because it includes too many formula fields with complex formulas, or too many custom fields. Ask your Salesforce admnistrator to remove some formula fields or simplify the formulas in use. Error message: "This record could not be loaded because it includes too many formula fields with complex formulas, or too many custom fields. Ask your Salesforce admnistrator to remove some formula fields or simplify the formulas in use."

 <lightning:recordEditForm aura:id="recordEditFormLine" objectApiName="OrderItem" recordId="{!v.orderItem.Id}" onsubmit="{!c.handleSubmit}" onload="{!c.onLoad}"  onsuccess="{!c.handleSuccess}" onerror="{!c.handleError}">
8
  • Can you specify the fields to load instead of a layout="FULL"? That would help you control how much is being loaded.
    – sfdcfox
    Commented Apr 14, 2020 at 22:10
  • Added the code snippet of what runs. IIRC, we don't specify layout in a recordEditForm.
    – Maya Tran
    Commented Apr 14, 2020 at 22:18
  • Oh, I was thinking of the other lightning data load thing. So... yeah, your page layout is probably too complicated, need to simplify the fields you have on it. We had this problem in our org for Accounts.
    – sfdcfox
    Commented Apr 14, 2020 at 22:39
  • 1
    Yes, complicated formulas are the number one cause of this exception. You can use workflow rules to calculate values and store them in fields to reduce formula complexity, optimizing formulas to be as minimal as possible, not use formulas in formulas, etc.
    – sfdcfox
    Commented Apr 20, 2020 at 14:56
  • 1
    (1) No, it's a Lightning issue (2) only the fields on the page layout. Note that simply having too many fields at all can cause this error. For example, if you have 700 text fields on your page layout, you'll likely get this error, even with no formulas. Formulas simply cause this error to happen sooner. Reducing the number of fields on your page may be necessary.
    – sfdcfox
    Commented Apr 22, 2020 at 21:48

1 Answer 1

0

This was actually due to a Salesforce known issue: https://trailblazer.salesforce.com/issues_view?id=a1p4V000001lUqTQAU

This was fixed in the Winter 21 Release.

You must log in to answer this question.

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