What is the limit for the number of records processed in a single transaction by triggers in Salesforce?

 The maximum number of records processed in a single transaction by triggers in Salesforce is 200. This limit applies to both synchronous and asynchronous triggers. For synchronous triggers, this limit is enforced for the entire trigger execution, regardless of how many DML statements are executed. For asynchronous triggers, this limit is enforced for each individual DML statement.

If a trigger needs to process more than 200 records, Salesforce will automatically split the trigger into multiple chunks of 200 records each. This process is known as bulkification. Bulkification is an important optimization technique for improving the performance of triggers, especially when dealing with large datasets.

Here are some additional details about the limits for triggers in Salesforce:

  • The maximum number of DML statements that can be executed in a single transaction is 150.
  • The maximum number of callouts (HTTP requests or web services calls) that can be made in a transaction is 100.
  • The maximum cumulative timeout for all callouts in a transaction is 10,000 milliseconds.

These limits are designed to protect Salesforce from runaway code and to ensure that all users have a fair share of resources. If a trigger exceeds any of these limits, Salesforce will throw an exception and the trigger will not be executed.

To avoid exceeding the limits for triggers, you should follow these best practices:

  • Use bulkification to process large datasets.
  • Batch DML statements together to reduce the number of round trips to the database.
  • Use as few callouts as possible.
  • Cache data that is frequently accessed.

By following these best practices, you can help to ensure that your triggers are efficient and performant.

Comments

Popular posts from this blog

What are the different Content Blocks in SFMC ?

What is the different email-sending options in SFMC with examples?

What are Profile Center and Subscription Center in SFMC