This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// GitHub repo link: https://github.com/salesforceBen/governorLimitsExercise | |
// Exercise 1 issue: | |
Task taskObject; | |
for (Contact contactObject : [SELECT Id, AccountId, LastName FROM Contact]) | |
{ | |
taskObject = new Task(WhoId = contactObject.Id); | |
insert taskObject; | |
} | |
// Exercise 1 fix: | |
List<Task> tasks = new List<Task>(); | |
Task taskObject; | |
for (Contact contactObject : [SELECT Id, AccountId, LastName FROM Contact]) | |
{ | |
taskObject = new Task(WhoId = contactObject.Id); | |
tasks.add(taskObject); | |
} | |
insert tasks; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment