Skip to main content

I get to know that records that are fire the after triggers are read only. so is there any possibility of recursive trigger on after event?

 

#Salesforce Development #Salesforce Developers #Salesforce Administrator #Salesforce Developers #Developer Beginner #Developers

1 respuesta
  1. 19 nov 2021, 7:02

    Hello @Abdullah Abdullah,

    Trigger recursion can happen if you don't have any specific filters or criteria for updating a related record in After Trigger, but this only happens if you update a related record from an after trigger, and that related record updates the original record in its after trigger.

     

    Eg. Say you have a Trigger on Opportunity object which has an after insert/update logic that updates some field on the quote, and now if the Trigger on the Quote Object has an after insert/update logic that updates some field on the Opportunity then in this case Trigger recursion will occur. To reduce the possibility of recursion take care of the conditions and the logic you use to make the DML.

     

    And as you said that the records are read-only in after trigger, which means you cannot make any changes to the field values of the record which invoked the Trigger from its after insert/update logic, but when said this it doesn't mean that they are read-only for the whole transaction these values can be changed by any other Trigger if it is invoked before the transaction is committed.

     

    Hopes this helps, if you find this or any other answer useful mark it as Best Answer so it will help others looking for the same.

0/9000