You need to sign in to do that
Don't have an account?
ABHIJEET BUDKE
Same logic trigger on multiple objects
Hi All,
I have one master (obj A) and 3 child object (ObjB,ObjC,ObjD) in look up relationship. Each child have Amt field and Mast have Final_Amount(ie sum of Amt all childs record) . I want whenever new record is created in any of child object sum of Amt field is get added\updated in master field.
Example
ObjB - 3 records Sum (Amt) = 40
ObjC - 2 records Sum (Amt) = 45
ObjD - 4 records Sum (Amt) = 50
So value in ObjA Final_Amounts should be (40+45+50)= 135
Now one more entry is added in ObjD with Value 10 Then Final_Amounts should be 145
First thought for this is Trigger on each 3 child object. But implementation\logic will be same for 3 trigger.(Want to avoid code same code repetition)
Is there any way I can achieve this with Trigger ?
Also please suggest some other way is there to achieve this.
I have one master (obj A) and 3 child object (ObjB,ObjC,ObjD) in look up relationship. Each child have Amt field and Mast have Final_Amount(ie sum of Amt all childs record) . I want whenever new record is created in any of child object sum of Amt field is get added\updated in master field.
Example
ObjB - 3 records Sum (Amt) = 40
ObjC - 2 records Sum (Amt) = 45
ObjD - 4 records Sum (Amt) = 50
So value in ObjA Final_Amounts should be (40+45+50)= 135
Now one more entry is added in ObjD with Value 10 Then Final_Amounts should be 145
First thought for this is Trigger on each 3 child object. But implementation\logic will be same for 3 trigger.(Want to avoid code same code repetition)
Is there any way I can achieve this with Trigger ?
Also please suggest some other way is there to achieve this.
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_sobject.htm