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
Nicola BiddleNicola Biddle 

Is it possible to create a formula/roll up summary field that calculates the total Amount of Orders, for this Financial Year, from looking at the Order Date.

This field then needs to display as a merge field on an Opportunity Email Template.

E.g. opp 1 - total order amount (across 2 orders in this FY) = $3000
        opp 2 - total order amount (across 1 order in this FY) = $1000
       Field should display $4000 as it's look across all orders for the whole Organisation.

 Also, how do I set the formula up so that it will only display the correct detail for this FY and how do I set it up for subsequent FYs, or will the formula have be changed each year?

Hi Nicola,

You need custom code for this purpose. 

Takes Freelance Job

Since Opportunity and Contracts have a Lookup relationship between them hence you would be unable to create a Rollup Summary field to cacluate the sum of all Order Amount values on Contracts for a given Opportunity Record. Here are the options that could prove helpful

1. You could implement a custom solution using a Apex Trigger that iterates through all the Contracts for a given Opportunity for the current fiscal year based on the specified date whenever a Contract associated with an Opportunity or the Opportunity itself is modified. Considerations of this approach.

  • Flexibility to implement custom business logic
  • Complete control over the behaviour of summation for e.g. you could implement a filtered summation logic to sum only those contracts which are active.
  • Increased go to market time due to custom development
  • Additional effort required to implement test code with adequate test code coverage for the implemented code which is mandatory for a production release.
  • Multiple triggers on the same object and the same event could lead to unpredictable output due to no control on the trigger execution precendence.
2. You could leverage free third party Appexchange tools to help accomplish this. The following tools should help you accomplish your given requriement.
  1. Rollup Helper (
  2. Rollup Summary Helper (
  • Ready to use solution
  • Reduced go to market times
  • Limited flexibility and control
  • Dependency on the package provider in case of issues
Please do not forget to mark this thread as SOLVED and answer as the BEST ANSWER if it helps address your issue.
Mustafa JhabuawalaMustafa Jhabuawala

Not possible using formula or roll up summary. You need to got with custom code like Triggers