Development questions

Why is Trigger.newMap not available in before insert?

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.

apex-triggertriggercontext-variables