function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sfdcjoeysfdcjoey 

What would happen if I perform a DML update operation on the before update trigger of the same sObject record ?

What would happen if I perform a DML update operation on the before update trigger of the same sObject record ?
Ankit SehgalAnkit Sehgal
if you update or delete a record in its before trigger, or delete a record in its after trigger, you will receive a runtime
error
Jamal RidaJamal Rida
When the trigger is fired there is a before and after, the before is used to update the current record without stating any DML. since the record is open for update/Insert. if you specify any DML during the before action, you will receive an Exception "You cannot Update and Active Entity". 
Now there are some cases where you need to fire the trigger on After insert in case you need the record Id as example, in this case you should query again the records after the trigger is fired and perform a DML on this new List. Because on After the record is Locked and you cannot perform DML directly on fired trigger records.

Please mark this as resolved if it answers your question.
Joe,
Guy_KeshetGuy_Keshet
nope, you cant.
if you want to update the record that is being changed - simply update it's fields in the trigger
If you need to create news records in the same object, or update related records, you should use process bulder.
If you want to delete records, that use the AFTER trigger instead