You need to sign in to do that
Don't have an account?
Siddharth Lakhotia
Trigger to calculate the sum of values from parent to child object field
Hi,
i need help in developing a trigger that calculates values from Parent Object Inquiry to child object Inquiry Details.
So every Inquiry record will have a field call Cushion Number( this acts as a code) and Act Sales.
I need to capture information of sum of ActSales against a cushion number and store it in a child object field Actual Sales..
how can I achieve this ?
i need help in developing a trigger that calculates values from Parent Object Inquiry to child object Inquiry Details.
So every Inquiry record will have a field call Cushion Number( this acts as a code) and Act Sales.
I need to capture information of sum of ActSales against a cushion number and store it in a child object field Actual Sales..
how can I achieve this ?
You wann say that copy the value of parent object to child object.
If I am right then you can do this thing by using formula field as well as trigger.
You need to create formula field on child object.
and second method is trigger.
I hope my this trigger will help full for you
So lets say,
For Inquiry 1 , Cushion no : 123 , ActSales : 100
For Inquiry 2 , Cushion no : 123 , ActSales : 200
For Inquiry 3 , Cushion no : 123 , ActSales : 300
For Inquiry 4 , Cushion no : 456 , ActSales : 350
For Inquiry 5 , Cushion no : 456 , ActSales : 450
I have a lookup at inquiry details that looks up to the Inquiry object,
I need to pull in the blanket no. against the inquiry and sum of Act Sales against cushion number(Cushion No ; 123 Actual Sales :600, Cushion Number : 456 , Actual Sales : 800).
if You make inquiry detail parent and inquiry child then you can total and save to the parent field.
But i am trying to slove also on your way.
Where are we taking account of cushion number here , I require summation of ActSales against cushion no.
As shown in example
For Inquiry 1 , Cushion no : 123 , ActSales : 100
For Inquiry 2 , Cushion no : 123 , ActSales : 200
For Inquiry 3 , Cushion no : 123 , ActSales : 300
For Inquiry 4 , Cushion no : 456 , ActSales : 350
For Inquiry 5 , Cushion no : 456 , ActSales : 450
I need to pull in the sum of Act Sales against cushion number(Cushion No ; 123 Actual Sales :600, Cushion Number : 456 , Actual Sales : 800).
Can you please help me with the solution based on the example given
I solve your problem.i hope this will help full for you.
i change schema of Object Relations.If You will do in this manner then your trigger would be easy so ..
below is given schema picture and triggers
You have to create one another trigger on Inquiry Detail in which just copy the value of act sales to there field after insert.
IF you wants to do this problem only using this two object i will try to resolve it.