Loading tutorials
Trigger.new and Trigger.old, and run DML statements such as update. It also assumes you know that governor limits apply to a whole transaction. Here you will learn the sequence Salesforce follows when it saves a record. That sequence6 min readTrigger.new and Trigger.old, and use insert and update statements. It also assumes you know that Salesforce enforces governor limits. The goal is to understand the mechanisms that make a trigger run again insi6 min readinsert and update statements, and know the main governor limits. The previous chapters showed how a trigger ends up calling itself. This chapter covers the simplest fix: don't issue the extra DML at all.5 min readList, Set and Map, and understand DML statements such as update. It also assumes you know the governor limits at a high level. You should recognize Trigger.new, Trigger.old and Trigger.oldMap from the earlier chapters on trig5 min readinsert and update. It also assumes you know that governor limits apply per transaction. Static variables are the tool that most recursion guards depend on, so you need a precise mod6 min readinsert and update DML, and you know what a static variable is in Apex. You should also know that triggers run inside a transaction with governor limits. Earlier chapters showed how a trigger can fire itself again. Here you add the5 min readList and Trigger.new. Here you will see how that guard silently loses work when a single DML statement touches more 6 min readSet<Id> and Map collections. It also assumes you know why a trigger that updates its own object can re-fire. The earlier chapters showed that a static Boolean flag stops the loop but can skip records when a6 min readList, Set, and Map, and issue DML statements. It also assumes you know that static variables keep their value for one transaction, and that you have seen the static Set<Id> guard from the previous chapter. Here you will move that g6 min readSet<Id>, and changed-field checks. Here you learn the opposite problem. Sometimes you want a trigger to run again, or5 min readSet<Id> guard, and the changed-field check. You should also know that governor limits apply per 5 min read