Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// 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