Last active
December 19, 2018 17:50
-
-
Save seanpat09/ebe6cc54da9c7177bfe7e631f7301d75 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
List<Account> testAccount = [SELECT Id FROM Account WHERE Name = 'Test Account']; | |
Account accountToArchive; | |
if (testAccount.isEmpty()){ | |
accountToArchive = new Account(Name = 'Test Account'); | |
insert accountToArchive; | |
} else{ | |
accountToArchive = testAccount[0]; | |
} | |
List<Opportunity> opps = new List<Opportunity>(); | |
List<Task> toInsert = new List<Task>(); | |
for (Integer i = 0; i < 100; i++) { | |
opps.add( | |
new Opportunity( | |
AccountId = accountToArchive.Id, | |
Name = 'TestOpp'+i, | |
StageName = 'Closed Won', | |
CloseDate = Date.today() | |
) | |
); | |
} | |
insert opps; | |
for (Opportunity o : opps) { | |
for (Integer i = 0; i < 75; i++) { | |
toInsert.add( new Task( | |
WhatId = o.Id, | |
Subject = 'Task ' + i, | |
Description = 'My Description' | |
) | |
); | |
} | |
} | |
insert toInsert; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment