Showing posts with label Workaround to use Trigger.newMap in Before Insert. Show all posts
Showing posts with label Workaround to use Trigger.newMap in Before Insert. Show all posts

Tuesday, 19 December 2017

Trigger.new Vs Trigger.newMap

What is the difference between Trigger.new & Trigger.newMap ?

Trigger.new : Returns list of the new versions of the sObject records

Trigger.newMap : A map of ID's to the new version of the sObject records.
Note : "Trigger.newMap" is available only in After Insert,Before Update,After Update.

Any workaround to use Trigger.newMap in Before Insert ?

Use below code to form the Map and use that in other places of logic.