I am writing an after insert, after update on Task object trigger. Both the insert code and the update code will make changes to records for a custom object which get updated.
I would like to know what happens if a task insert and a task update happen in the same execution context - does the update customObjList
get called twice?
trigger TaskUpdateCustomObject on Task(after insert, after update) {
List<CustomObject__c> customObjList = new List<CustomObject__c>();
if(Trigger.IsInsert) {
// possibly add custom objects to update
}
if(Trigger.IsUpdate) {
// possibly add custom objects to update
}
update customObjList;
}
This might seem like a stupid question, but I just want to get clear in my head that the trigger code will run on 2 separate occasions. Once on insert and once on update.
Thanks