Let’s say we have to update the same record in after trigger context. Is there any way or workaround?
Answer / Sunita Tevatiya
To update the same record multiple times within an After Trigger, you can use a static variable to store the ID and compare it before updating the same record. However, be aware that this might lead to issues if your trigger is invoked in a loop. It's better to consider using Apex Queue (Batch Classes) or Future methods for processing multiple records.
| Is This Answer Correct ? | 0 Yes | 0 No |
What are the types of sharing rules in salesforce and explain it?
How many records can we fetch using one soql query?
Explain Data Migration in Salesforce?
Explain Approval Terminology?
What can cause data loss in salesforce?
What are validation rules? : salesforce validation rules
Is it possible to change the existing data types of custom fields, if Yes please explanin?
What is the apex in salesforce?
Why we use @future annotation?
How do you create a lightning app in salesforce?
What is the appexchange?
When can you use sandbox org?