function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rohit kumar singh 1Rohit kumar singh 1 

Can SomeOne Explain the working/control flow

trigger Oldtrigger on Contact (before update,after insert) {
for (Contact account : {
Contact oldAccount = Trigger.oldMap.get(account.ID);
How is it working and where I can see the output.
Nishad KNishad K
Hi Rohit,
Trigger.oldMap is only available in update and delete triggers. so you can't use in after insert,

See the below links:

Trigger Context Variables (

Vivek C 1Vivek C 1
Hi Rohit,

The trigger.oldMap context variable is only available in the Update and and Delete triggers.

In your trigger, When you update the account name of a Contact (Supose you change the account name of a Contact from ABC to XYZ ). The the Update trigger fores and in the Trigger.oldMap it stores the previous value of ABC. So in the duebug you will get the account id of ABC.

Hope this is pretty much clear to you !.