You need to sign in to do that
Don't have an account?
Rahul Kainth 14
Governor limit refresh on change of trigger context
Hi. I have a question regarding apex trigger context. Suppose If I want to update account in after update context, and right after updating account, I want to update contact in account trigger only. Now Contact trigger will run. The question is as trigger context is changed from account to contact, will it refresh governor limit as well?
As per my understanding, this would refresh the limit. However, I would suggest replicating the scenario and check debug logs that can help you and give more details on limits.
https://developer.salesforce.com/docs/atlas.en-us.salesforce_app_limits_cheatsheet.meta/salesforce_app_limits_cheatsheet/salesforce_app_limits_platform_apexgov.htm
Thanks,
If you use a future method, it will be a new transaction with new governor limits.
If you implement the account update on before context trigger and then the contact update on after context, it will be the same transaction context and will not refresh your governor limits.
And if we check this reference:
Context Variable Considerations | Apex Developer Guide | Salesforce Developers (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_context_variables_considerations.htm)
Even though it is possible to update the original object in the "after update" event, it is not considered best practice as it could cause an infinite loop
regards
Andrew