You need to sign in to do that
Don't have an account?
Chubby
Apex code to update field on grandparent when a field on grandchild inserted or update
Hi All,
I have 3 objects A(grandparent), B(parent), C(grandchild). whenever grand child with type XXX is inserted or updated i want to update a field on grandparent. Pls help me with coding.
Thanks for your help.
I have 3 objects A(grandparent), B(parent), C(grandchild). whenever grand child with type XXX is inserted or updated i want to update a field on grandparent. Pls help me with coding.
Thanks for your help.
Hi Chubby,
This code i hvae in my org so i have send you for just information ,,here expense_Item__c is grand child and Expense__c is its parent . And Expense__c have lookup on itself as well i called it yearly expense.
But you have one other best way to update grand parent is that you run you grand child object on before Trigger ,,,and parent trigger in After Trigger. The benifit of it is that in after trigger you have the id of grand child object record id as well and that record is already hit to the database,,, so you can just get the grandchild record through query and update grand parent according to that
Thanks