Delete challenge-created records
delete removes records by Id.
Your task
Create two tagged Accounts, delete the whole list in one statement, and prove they moved to the Recycle Bin.
String tag = 'AS-DELETE-' + UserInfo.getUserId() + '-' +
String.valueOf(Datetime.now().getTime());
List<Account> accounts = new List<Account>{
new Account(Name = tag + '-A', Description = tag),
new Account(Name = tag + '-B', Description = tag)
};
Set<Id> createdIds = new Set<Id>();
Integer dmlBefore;Requirements
delete accounts;should be presentALL ROWSshould be presentId IN :createdIdsshould be present- Both owned rows should be printed as
Created count: 2 - No active owned rows should be printed as
Remaining active: 0 - Both bin rows should be printed as
In recycle bin: 2 - One delete statement should be printed as
Delete statements: 1