Loading tutorials
Trigger variables hold data, which ones are null in each event, and how to branch on the context flag5 min readTrigger.new as a list, and have written simple SOQL queries and DML statements. The previous chapters covered governor limits and why triggers always receive a list. This chapter turns that knowledge into a repeatable refacto5 min readTrigger.new. Once SOQL and DML are out of your loops, collections carry the data between the steps of a bulkified trigger. This chapter covers what each collection t5 min readTrigger.new and Trigger.oldMap context variables. It also assumes you know the limit of 100 SOQL queries per synchronous transaction. The goal is to replace a query per record with one 4 min readTrigger.new and Trigger.oldMap, and have used insert, update, and Database.insert. You will learn how to reject single records inside a batch, how the DML option allOrNone decides what happens to the rest of t5 min readTrigger.new, Trigger.oldMap), and understand why triggers must handle lists of up to 200 records. It shows how to move trigger logic into a handler class so the logic is easier to test, read, a5 min read@IsTest, that you know the insert and update statements, and that you have read the earlier chapters on governor limits, Maps, and the handler pattern.5 min readTrigger.new with Trigger.oldMap. It covers how a trigger ends up running itself, how static variables guard against that, and where those guards cause bugs.5 min read