What's the content of Trigger.new?

Let's look at one of the frequently asked interview questions - What's the content of Trigger.new?

Am sure you would have heard about this question in your interviews. Let's a bit more about it in this post.

In triggers, we have a few context variables like Trigger.new, Trigger.old Trigger.newMap, Trigger.oldMap and etc.

The content of Trigger.new and Trigger.old is going to be List and the content of Trigger.newMap and Trigger.oldMap is going to be a map (as in the same you will be presented the same content but in a different representation).

In fact, we can also use Trigger.new as shown below and it's going to work absolutely fine.

trigger AccountTrigger on Account(before update){

	List[Account] accounts = [Select Id, Name FROM Account WEHRE Id IN: Trigger.new]

Trigger.new used in SOQL query

Hope this was helpful!