Year End Tax Receipt for Donors

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.

Package includes this sample template.

Thanks for the great app, just in time…Simple, easy, elegant, and just what we needed.



  • You must re-run the app every year! It does not update on its own!
  • 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!

Here’s a screen shot of my page layout with the custom field Gifts Last Year populated.

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.

Set Up Instructions

    • 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
  2. Install in Sandbox org with NPSP.
  3. 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.
  4. Add Gifts Last Year custom field to your Contact page layout.
  5. 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.
  6. Go to NPSP Settings from App Manager.
  7. Select Bulk Data Processes.
  8. Select Rollup Donation Batch.
  9. Click Run Batch.
  10. Click on the Setup Icon.
  11. Search for and select Flows.
  12. Pick your 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.
  13. Click Run in the top right corner.
  14. 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. 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!

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!


  • 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.


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…

    Published by


    Jessie joined in 2018 to give introductory webinars to nonprofit customers. She now is a Senior Solution Developer supporting nonprofits and education customers at Salesforce. All opinions expressed on this blog are her own or those of the contributors. She's spent 17 years more or less in CRMs and databases, but didn't meet Salesforce until 2011. Jessie co-led the Seattle Salesforce Nonprofit User Group in 2015-2016. She wrote a sh*tty first draft of a novel and hopes to turn it into a screenplay!

    One thought on “Year End Tax Receipt for Donors”

    Leave a Reply