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 

Need help in writting trigger?

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.
Jolly_BirdiJolly_Birdi
Hello @Sidharath

Trigger would be complicated way for this, Instead of trigger you can create a roll up summary field affter converting normal lookup to master lookup relationship. Or you can use a new App which is free of cost and help you the get the appropriate results named as Declarative Lookup Rollup Summaries. If you still want to go with trigger, then for this you need to proceed with aggregate results or if you have written some code for this then you can share I will help you with that.

Please mark this as best answer if you find it positive.

Thanks,
Jolly Birdi