What is the limitation of Apex trigger?

What is the limitation of Apex trigger?

Size-Specific Apex Limits

Description Limit
Maximum number of characters for a class 1 million
Maximum number of characters for a trigger 1 million
Maximum amount of code used by all Apex code in an org 1 3 MB
Method size limit 2 65,535 bytecode instructions in compiled form

What do you need to know about apex triggers?

Apex triggers enable you to perform custom actions before or after changes to Salesforce records like insertions, updations, or deletions. A trigger in Apex code is a set of statement that executes before or after the following types of operations, such as insert, update, delete, merge, upsert, and undelete.

Why are there limits to code execution in apex?

As we know, Apex runs in multi-tenant environment, i.e., a single resource is shared by all the customers and organizations. So, it is necessary to make sure that no one monopolizes the resources and hence Salesforce.com has created the set of limits which governs and limits the code execution.

When do you hit the soql limit in apex?

The following trigger iterates over a list of customers and updates the child record’s (Invoice) description with string ‘Ok to Pay’. When the ‘updateCustomerDescription’ method is called and the number of customer records are more than 100, then it will hit the SOQL limit. To avoid this, never write the SOQL query in the For Loop.

What’s the maximum number of rows an apex class can insert?

The maximum number of rows that can be inserted, updated, or deleted, in a single, synchronous Apex test execution context, is limited to 450,000. For example, an Apex class can have 45 methods that insert 10,000 rows each. If the limit is reached, you see this error: Your runallTests is consuming too many DB resources.