5 min read
Inheriting a Salesforce org from another administrator can be both freeing and frustrating. One major source of frustration we’ve seen recently? New admins logging into their new-to-them orgs, only to find that the previous admin enabled Custom Fiscal Years.
*cue melancholy music*
This is horrifying for a couple of reasons, mainly
1. Your organization does not have custom fiscal years. Say it with me: “My organization does not have custom fiscal years.” That’s right, if your organization’s fiscal year is a standard 365 days (no matter when it starts), then you do not need Custom Fiscal Year enabled.
2. Once you turn on Custom Fiscal Year, you can’t turn it off. Ever. Even Salesforce Support can’t turn it off for you. You’ll need to start a whole new instance of Salesforce.
3. All of your NPSP rollup fields that calculate donations based on Fiscal Year are invalid because they aren’t compatible with the Custom Fiscal Year setting.
So what’s an admin to do?
After shaking your fists at the sky and crying out in frustration, head over to the AppExchange and install Declarative Lookup Rollup Summaries (DLRS)* in your Salesforce instance, because we’re going to solve your donation rollup problem!
Once you have DLRS installed in your org, you’ll need to create a few fields on the Opportunity and Contact objects to help with the rollup calculations.
First, create a number formula field to calculate the Fiscal Year on the Opportunity (Donation). The formula should look something like this:
MONTH( CloseDate ),
1, (Year( CloseDate )),
2, (Year( CloseDate )),
3, (Year( CloseDate )),
4, (Year( CloseDate )),
5, (Year( CloseDate )),
6, (Year( CloseDate )),
In this example, a donation made on 2/1/2016 (February 1st, 2016) would be assigned as Fiscal Year 2016, while a donation made on 7/1/2016 (July 1st, 2016) would be assigned as Fiscal Year 2017.
Update the formula so the CASE function includes a line for every month in the calendar year before your fiscal year start. For example, this organization’s fiscal year starts on July 1 (7/1), so I included a CASE condition for months 1-6.
Create a currency field on the Contact to hold the sum of donations for a particular fiscal year (i.e. Sum of Donations FY2017). This is where the result of your DLRS rollup summary will go.
Next, create the Lookup Rollup Summary to sum the amount of all related Opportunities (Donations) that are Closed Won and fall in that fiscal year. The key is setting the Criteria: StageName = 'Closed Won' AND Fiscal_Year__c = 2017.
Similarly, if you want to count the number of donations in a particular fiscal year, you just need to create a number field on the Contact object to hold the amount and create a Lookup Rollup Summary where the Aggregate Operation is Count.
But what if I just want a field that calculates for THIS fiscal year?
The only way to automate that is with custom Apex code. However, you can “hack” a solution with DLRS by just updating the year specified in the Relationship Criteria to the current fiscal year. (You’ll just need to remember to update it each time a new FY rolls around.) Just remember to click Save and then Calculate when you update the year so all your Contact records get updated.