I'm doing some tests for triggers and I'm seeing that Trigger.Old is returning the new values of the updated object , instead of the old values. I'm assigning the values to a List, so I can then access them with that variable. Here is the code that I use:
trigger testTrigger on Account (after update) {
List<Account> allAccounts=[select Id,ACV from Account where Id IN: Trigger.newMap.keySet() ];
List<Account> allOldAccounts= [select Id,ACV from Account where Id IN: Trigger.old ];
System.debug('Value of New Accounts: '+allAccounts);
System.debug('Value of old Accounts: '+allOldAccounts);
If I go and change ACV from 0 to 777, I expect to see for the first debug line, the new value of 777, and for the old value 0. That is not the case, and both of them are returning the NEW value of 777.
Any idea what I'm doing wrong?