I am getting bit confused on the probable answer as to what would happen on executing the below code block (considering trigger event as After Insert and scenario as to Create a Follow Up Task whenever a new Task is created)?
List<Task> newLstTask = new List<Task>();
for(Task t : trigger.new){
Task tsk = new Task();
tsk.Subject = 'Follow Up';
newLstTask.add(tsk);
}
insert newLstTask;
Would this as I'm thinking result in infinite loop and eventually fail or would it end up creating multiple tasks for each Task in trigger.new?
Currently I get an error dml statement cannot operate on trigger.new or trigger.old after insert when I create a Task from UI on any object.