function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Siddharth LakhotiaSiddharth Lakhotia 

Trigger to summarize value of a field?

Hi,

I have 2 objects Object A and Object B

Object B has a lookup to object A.

Object A has three fields  Aname , BNmber and ASales

Bnumber is a code and can have several values against it.

Bnumber 123        ASales 100

Bnumber 123        ASales 300

Bnumber 123        ASales 500

I need help in writting trigger on object B, that pulls sum of Asales against Bnumber ( 900 against 123 in this case) 

The sum of Asales against Bnumber should be stored in a field on Object B...

Post that I can rollup this object to Opportunity(master) and then the actual sales will appear on the opportunity
AJAY SINGH 68AJAY SINGH 68
Hi Siddharth,
As per your requirement you want sum of Object A Sales on Object B.
for this you can create a rollup field on Object B on Object A Sales.
Siddharth LakhotiaSiddharth Lakhotia
It's a lookup relationship.. I cannot have a roll up summary for it.. also , I need sum of Asales against a comman Bnumber Let's say.. if Bnumber in different records is command but the value is different as mentioned in the question. Also since this object itself has a master detail relationship to another opportunity object..
Siddharth LakhotiaSiddharth Lakhotia
Can anyone help a bit on this one