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
MC34MC34 

Order total amt for this year and last year on account object. Trigger?

Hi there, 

I have been tasked with creating two fields on the Account object that pull the currency field total "EBS header total_c" on the EBS Order  custom object. Currently lookup relationship is from  EBS Order to the Account Object. 

I Need two fields on Account Objects: 
EBS Order Total (Current year)
EBS Order Total (Last Year)
Any idea how to achieve this? Here is the schema: 

User-added imageI cannot create any new field on custom order object as it is directly integrated with Oracle. 

Trigger woud be helpful. Not a coder :( 

Thank you.
Andrew GAndrew G
Hi Natto

If you have a master-detail relationship, then you could do a rollup summary.

If not a master-detail, If you wish you could investigate some appexchange packages - search for rollup.

Here is a stackexchange article that should give some direction to your query where you could do it as a Trigger, with an additional link on how to do it with a flow.

https://salesforce.stackexchange.com/questions/33650/how-to-write-a-rollup-summary-trigger-for-a-lookup-relationship

Regards
Andrew