February 24, 2026 by Paul Conley
February 24, 2026 by Paul Conley
DocGen in Agentforce Nonprofit (fka Nonprofit Cloud)
The quick TLDR; Agentforce Nonprofit has a built-in document generation function. It's powerful and hopefully after reading this article you can say that it's easy to use.
This is a somewhat cathartic blog for me to write having spent hours and hours in the weeds trying to get document generation working in NPC. There are so many hints that it should work easily and yet it gets commingled with OmniStudio’s document generation functionality which includes Data Mapper, Data Transforms and the like.
Why my angst on the subject? NPC is built on the Financial Services Cloud which in turn brings in the all powerful OmniStudio functionality. This is great and part of the value-add of NPC. Unfortunately, OmniStudio has a painfully complicated (and probably powerful if I could ever get it working) document generation functionality. I don’t want to talk about this layer, ever…
The NPC document generation functionality skims on the surface of OmniStudio’s but the reality of using it is you avoid any configuration settings that drag you towards OmniStudio. The result is some modals (looking at you Design Document Template) you provide three fields and skip about eight ominous looking fields.
Either way, I got it working. It's not well documented and I wanted to share it with the nonprofit Salesforce community.
The following four steps should get you up and running on DocGen in NPC.
The template for DocGen can be either a word doc or a power point presentation. For this example I’m using a simple docx file with an equally very simple email structure. Everything donor-level needs the outer loop; everything gift-level needs both loops nested. This step defines the fields which will be replaced with appropriate values in the generated document.
The outer loop (i.e. Donor level) is created by:
{{#acknowledgmentQueryDonors}}
.
.
{{/acknowledgmentQueryDonors}}
The inner loop (i.e. Gift Transaction level) is created by:
{{#nonCommitmentTransactions}}
.
.
{{/nonCommitmentTransactions}}
Here's the template for a standard letter:
{{#acknowledgmentQueryDonors}}
Dear {{name}},
{{#nonCommitmentTransactions}}
Thank you for your generous gift of ${{currentAmount}} received on {{transactionDate}}, paid by {{paymentMethod}}.
{{/nonCommitmentTransactions}}
Your continued support means so much to our organization.
Sincerely,
The Nonprofit Team
{{/acknowledgmentQueryDonors}}
Here are some standard fields that may be useful:
Donor Level (outer loop):
Name
{{name}} (full name)
{{firstName}} / {{lastName}} separately if you want "Dear Homer," vs. "Dear Mr. Simpson," style. {{salutation}} is also available (e.g. "Mr.", "Dr.") if you want to build a formal greeting.
Donor mailing address
{{personMailingStreet}}, {{personMailingCity}}, {{personMailingState}}, {{personMailingPostalCode}}
Total giving (if summarizing instead of itemizing)
{{totalAllTransactions}}
Gift Level (inner loop):
Date of donation
{{transactionDate}}
Payment method
{{paymentMethod}}
Gift/campaign or fund
{{campaignName}}
Check date (if paid by check)
{{checkDate}}
Non-tax-deductible portion
{{nonTaxDeductibleAmount}}
Value of goods/services received (donor covers fees)
{{donorCoverAmount}}
This stage loads the template into Salesforce and describes how the template is to be used. The key to this stage is to provide the minimum input to get DocGen working and not try to over complicate the configuration.
From App Launcher > Design Document Template > Create Template
Template Type = Microsoft Word
Token Mapping = JSON (leave default; no Data Mapper Bundle needed)
Token Mapping Methods = Omni Data Transformation
Leave DataMapper Transform Name, DataMapper Extract Name and Usage Type blank
Attach the .docx
Save & Activate
This stage controls the generation of the document. You select the output name of the file to be generated and you also select the type of file (based on the template). The functionality allows for filtering down to a single Gift Transaction and also provides the capability to update fields in the Gift Transaction.
On the Account record (Person Account or Business Account)
Click Generate Document. This is sometimes hidden way down the menu under the chevron on the Highlight Panel. I suggest moving up the placement of the Action Generate Document so that it shows on the Highlight panel as a button.
In the modal
Name the output file, this can be any name but I’d suggest using one that identifies the donor so you can find it later.
Pick your template (If your template doesn’t show; check that it was activated)
Acknowledgement Criteria - There is a handy feature that shows the current count of records which match the entered criteria. If you narrow down the range or select a specific status value that allows you to find a single transaction. This is key; the template above is built to loop through all matching Gift Transactions which may not be the desired behavior. It might be easier to play with this to understand exactly how the template renders the output file.
Acknowledgement Options - Again this is a powerful section that allows you to set the values back in the individual Gift Transactions to keep track of documents that you’ve generated.
Select Generate
Once the document is generated, it is attached to your user in Salesforce. You can access the file as follows:
App Launcher > Files
Select file from list
The DocGen functionality is straightforward to use once it's configured and you understand how the template looping works. It's also important not to stray into the DocGen functionality of OmniStudio. Have fun, and feel free to reach out to us if you have any questions!