<turbo-stream action="update" target="wiki_card"><template>
<h1>E2120 Too many query rows</h1>
<p>When "Too many query rows: 50001" and "CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY" appear together, it means that an insert or update operation is failing due to a trigger or automation exceeding the SOQL query row limit (50,000 records).<br><br><strong>E2120 - ECE_SForceUpdateInsert: We got an error back from SalesForce when trying to update or insert data in SalesForce.<br>Error returned from SFDC on upsert: [message: SalesOrderLineTrigger: System.LimitException: Too many query rows: 50001 , statusCode: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY ] , Record does not exist in SFDC, Data sent to SFDC: sObjects: [type: SalesLine__c , Unique_Key__c: 0#SO-013018#40000 , Name: 00040000 , No__c: LT , Description__c: Production only.<br><br></strong><strong><u>What is happening in Salesforce?</u></strong><strong><br><br>A record (or multiple records) is being inserted or updated.</strong></p><ul><li>This is usually through an API call in Salesforce.</li></ul><p><strong>A trigger, Process Builder, or Flow runs as part of this insert/update.</strong></p><ul><li>The automation contains SOQL queries.</li></ul><p><strong>The SOQL query inside the automation retrieves more than 50,000 records.</strong></p><ul><li>Salesforce enforces a governor limit that prevents a <strong>single transaction</strong> from querying more than 50,000 rows.</li></ul><p><strong>Salesforce throws "Too many query rows: 50001".</strong></p><ul><li>Because this happens <strong>inside a trigger or automation</strong>, the insert/update cannot proceed.</li></ul><p><strong>The error "CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY" is thrown.</strong></p><ul><li>This tells you that the failure happened due to a <strong>trigger, Process Builder, or Flow</strong> that was supposed to run during the record update.</li></ul><p><strong>Solution</strong>:</p><ul><li><strong>Add Selective Filtering to SOQL : </strong>Instead of querying <strong>all</strong> records, only query the <strong>needed ones</strong>.This ensures only the required records are queried, avoiding the 50,000 row limit.</li></ul><p><br></p>
</template></turbo-stream>

<turbo-stream action="replace" target="meta_description"><template><meta content='E2120 Too many query rows' id='meta_description' name='description'></template></turbo-stream>
<turbo-stream action="replace" target="meta_keywords"><template><meta content='E2120 Too many query rows Cannot insert update activate entity' id='meta_keywords' name='keywords'></template></turbo-stream>
<turbo-stream action="update" target="meta_title"><template>E2120 Too many query rows - MyRapidi Wiki</template></turbo-stream>
<turbo-stream action="prepend" target="flash"><template></template></turbo-stream>
