# Why is Trigger.newMap not available in before insert?

**Topic:** Apex Trigger · **Difficulty:** Easy · **Asked at:** Salesforce, Deloitte, Persistent · **Tags:** apex-trigger, trigger, context-variables

Read it on the site: https://www.forcechallenges.com/interview-questions/why-is-trigger-newmap-not-available-in-before-insert

## Answer

`Trigger.newMap` is a `Map<Id, SObject>`. In a before insert trigger, the records have not been saved yet, so **no Id has been assigned**. A map keyed by Id cannot be built, so `Trigger.newMap` is null.

Use `Trigger.new` in before insert. From after insert onward, Ids exist and `Trigger.newMap` is populated.

---
Source: ForceChallenges · last updated 2026-10-21
