You need to sign in to do that
Don't have an account?
CvrK
Is it possible to perform dml operation in after triggers?
Hi
1) Is it possible to update a child record when its associated master record is updated with a particular value on after update trigger?if possible which trigger context variable best suits the requirement?
For Example: when ever a field FA1 is updated with a X value in the master object then a field FB1 should be updated with X value on after update event.
2) similarly is it possible to delete child record when a master record is updated on after update event?
1) Is it possible to update a child record when its associated master record is updated with a particular value on after update trigger?if possible which trigger context variable best suits the requirement?
For Example: when ever a field FA1 is updated with a X value in the master object then a field FB1 should be updated with X value on after update event.
2) similarly is it possible to delete child record when a master record is updated on after update event?
context variable, as this one will hold the up-to-date version of your parent object (including - as pcon said again - the Id field if it is an insert.
You shouldn't typically iterate over the contents of the trigger.old map values - you should mostly use this for referencing old values using the map.get() method to compare to the new values. trigger.new is your power-list.
https://developer.salesforce.com/forums/?id=906F0000000Az72IAC
Please check below post how to stop recursive Trigger
how to stop recursive trigger in salesforce
http://amitsalesforce.blogspot.in/2015/03/how-to-stop-recursive-trigger-in.html
Trigger Best Practices | Sample Trigger Example | Implementing Trigger Framework
http://amitsalesforce.blogspot.in/2015/06/trigger-best-practices-sample-trigger.html
Trigger Context Variables
http://amitsalesforce.blogspot.in/2015/10/trigger-context-variables.html
Please let us know if this will help you
Thanks ,
Amit Chaudhary