Rationale

The act of creation  of an object should not alter significant data on the server side or have  other significant side-effects. For this reason using DML statements inside constructors is generally considered unsafe.

Scope 

  • Apex classes
Did this answer your question?