Update 1/20/2025: Added instructions on how to change on column.
Update 1/3/2024: Added instructions on how to re-run the data a year later.
UPDATE 1/13/23: If you’re installing today from AppExchange, it’s a new version 1.4 that you can run by running a flow called Year End Tax Flow. New detailed instructions below. To install the new version, please uninstall the old version first! Go to Setup, search for “Installed Packages,” find “Year End Tax” and uninstall that.
Easy peasy list of all last year’s donations
Send your donors (contact records only) a tax receipt at the beginning of the new year listing all of last year’s donations. For Salesforce Nonprofit Success Pack users, this unmanaged package will generate a table for each donor listing the gifts they made last year. Use your own email to send a tax receipt by email. The table lists the amount, date and, optionally, the campaign name of each donation.

Thanks for the great app, just in time…Simple, easy, elegant, and just what we needed.
David, Eaglesrest.org
Caveats
- The data does not update on its own. You need to re-run the flow. Learn more.
- This tool doesn’t decided for you what gifts should be tax deductible. It doesn’t provide a fair market value. I’m not deciding that for you. I’m not giving you any tax advice. Salesforce is not giving you any tax advice. Please talk to your tax advisor to decide what gifts should be tax deductible.
- It does not work for donations from accounts.
- Send me a message via Trailblazer Community if you need it to work for millions of records. I’ve got the code for that.
- This does not work for paper letters, but here’s a tutorial on how to do that.
Install from AppExchange
Click here to go to AppExchange to install the app.
Requires Nonprofit Success Pack.
How It Works
This package will populate a custom field Gifts_Last_Year__c.
- Contact Criteria: Total Gifts Last Year > 0
- Opportunity Criteria:
- Closed Date = Last Year
- IsWon = True (so that means any opportunities that were “Closed Won” or “Posted,” whatever you call the stage or status)
- Customizable Rollups must be enabled in NPSP.
It works in batches so it should be able to handle many gifts at once!

What It Doesn’t Do
This package will not send the email for you. You can modify the template that’s included with the package if you want to send the email out through Salesforce. You can use the custom field Gifts Last Year in your preferred email marketing tool. As under caveats, it does not update every year. Re-run the appropriate flow.
Set Up Instructions
- BEFORE YOU INSTALL:
- Enable historical trending for opportunities.
- Search for Historical Trending in Setup.
- Search for Opportunity in the search box and select it below.
- Check Enable Historical Trending
- Enable historical trending for opportunities.
- Install in Sandbox org with NPSP.
- Install for Admins only is fine. There is a permission set included if you need to give others the ability to access the field or see the apex.
AFTER YOU INSTALL:
- Add Gifts Last Year custom field to your Contact page layout.
- Make sure Total Gifts Last Year (an NPSP rollup field) is up to date. If you just entered gifts from last year today, you’ll want to force that roll up now.
- Go to NPSP Settings from App Manager.
- Select Bulk Data Processes.
- Select Rollup Donation Batch.
- Click Run Batch.
- Click on the Setup Icon.
- Search for and select Flows.
- Pick your flow.
- A. If you want to include the Campaign name in the table, click Year End Tax Flow with Campaign Table.
- B. If you don’t want to include the Campaign name, click Year End Tax Flow.
- Click Run in the top right corner.
- Your code will now run in batches and you’ll get an email when it’s all done!
Now you’re ready to send your emails or merge your letters!
- You decide who will get the email and how you send it. Remember, the field is only populated on contacts with Total Gifts Last Year > 0.
- Include the merge fields Gifts Last Year and Total Gifts Last Year in your template or copy the Classic email template included in the package.
How to Add Columns
Look at my code that’s here on GitHub. [VERY IMPORTANT NOTE: THIS CODE IS AN OLDER VERSION AND CANNOT BE LAUNCHED FROM A FLOW. EITHER FOLLOW THE INSTRUCTIONS AT THE TOP OF THE CODE FOR HOW TO LAUNCH OR JUST USE IT AS A LEARNING TOOL]
Give it a try even if you haven’t looked at Apex code before! Compare the yearEndGiftBatch class with yearEndGiftCampaignTable class, which also includes the name of the campaign in the gift table. I’ve added in additional instructions starting on Line 6 to yearEndGiftCampaignTable that aren’t in the package.
Another way to see the differences is to copy the code from Comparison V1 and Comparison V2 and paste them into this code comparison tool. I removed the comments from these files to make it easier to see what’s different. I hope this helps!
*NEW INSTRUCTIONS * How to Change One Column
Let’s say you want to display Amount, Date and a custom field on the opportunity called Tax Deductible Amount (tax_deductible__c). You still want to filter on the contacts where Total Gifts Last Year (npo02__OppAmountLastYear__c) is greater than 0.
- In your sandbox, in the developer console, open the apex class yearEndCampaignTable.
- Find and replace
Campaign.NamewithTax_Deductible__c(there will be two instances) - Find and replace
>Campaign<( or>Campaign Name<) with>Tax Deductible Amount<(there will also be two instances of this). - Save your changes and deploy to production.
- Run the Year End Tax Flow with Campaign Table. (I am terrible at getting the names exactly right. I hope I did).
If you want to change the it to a different field on campaign, (let’s say it is called Other Field) then instead:
- Find and replace
Campaign.NamewithCampaign.OtherField__c(there will be two instances) - Find and replace
>Campaign<( or>Campaign Name<) with>Other Field<(there will also be two instances of this).
Change Which Gifts are Included
What if you only want to include some gifts that are marked as Tax Deductible or you want to include gifts from this Fiscal year? You’d need to query on a different roll-up field AND possibly add additional criteria. Learn how to modify the apex to work for you here!
How to Get Updated Data a Year Later
- You need to re-run the appropriate flow.
- If you want to include the Campaign name in the table, click Year End Tax Flow with Campaign Table.
- If you don’t want to include the Campaign name, click Year End Tax Flow.
- This will overwrite data from the previous year for donors whose Total Gifts Last Year > 0. If your donor gave two years ago but not last year, the data from two years ago will still be in the Gifts Last Year field. To say that a different way if I run the flow on 1/1/24 and Joe gave in 2022 but not in 2023, the data from 2022 will still be in that field for Joe.
- Therefore, make sure your report is not based solely on Gifts Last Year not equal to blank. You could run your own flow first that deletes all the data from the Gifts Last Year field and then populate it again.
Gratitude
- Thanks to my colleagues David Fromstein and David Glick for their support on this project. David F. built a gorgeous admin-friendlier version of this that we hope to deliver to you at some point.
- Thanks to my colleague Alison Zwecker who installed the package for the first organization, Girl Build!
- Narender Singh who showed us how to make a data table with flow.
Feedback
Please let me know what you think! Are you using this for your letters? I’d love to list your organization here as a user.
More About Emails with Tables
-
Year End Tax Receipt for Donors
Send your donors a tax receipt at the beginning of the new year listing all of last year’s donations. For Salesforce Nonprofit Success Pack users, this tool will generate a table for each donor listing the gifts they made last year. Use your own email tool to send a tax receipt. The table lists the…
-
Send Tables in Email in Flow – NPSP Example #2 Memorial Gifts
Send an email with Salesforce NPSP listing all the donations/opportunities made in tribute, memory or honor of someone. With a few clicks, an email will be sent out with a table of all relevant donations.
-
Send Emails with Tables in Flow – NPSP Example with Payments
This post is building on the work of the super-smarty Narender Singh aka ForcePanda aka @Nads_P07. With Spring ’21 rich text emails, you can now send tables with lists of child objects. I followed his tutorial and built two flows specifically using Nonprofit Success Pack (NPSP) objects. The first one is a list of payments…
One thought on “Year End Tax Receipt for Donors”