Contact us Blog

Generating documents: examples

Here are a few examples of real-world document generation needs, along with an outline of the processes for fulfilling those needs.

Year-end tax letters by Household

In this example, we'll look at how to generate tax letters for your donors. The stated requirement here is that we wish to generate one document for each household, containing a list of all the donations given by any member of the household. We'll assume that you are familiar with Apsona's document generator. You might also find it helpful to read about generating sub-lists in documents. We'll also assume that you are using (or familiar with) the Salesforce Non-profit Success Pack, which contains the Household and other related objects.

If you want to try this merge action in your org, you can download this file, and then import it into your org via Settings - Apsona items - Tools - Import in Apsona.

  1. The first step is to create a document template laid out in the format you want. Below is a screen shot of a simple template we will use. If you like, you can download the .docx file that produced this screen shot. For simplicity, we have included just seven "top-level" merge fields (FormalGreeting, StreetAddress, City, State, Zip, Today and TotalLastYear) pertaining to the household, to be produced from the main data source for the merge. It also contains three fields (Name, Date and Amount) to be produced in the sublist. We have chosen Donations as the name of the sublist, as you can see from the TableStart tag in the screen shot above.
  2. Next, create a report that produces the data for the sublist. We can create a simple Opportunity Contact Role report that produces the donation name, household, contact name, amount, close date and opportunity id, as in the screen shot below. We can set up a filter to ensure that it produces all the donations from last year. Note that we do not set up any filter terms to limit the households or contacts that this report produces. The linkage to the specific households will be accomplished by the merge action. Note, by the way, that we need the Household ID in the sublist so that we may correlate the donations with the households. And we need donation information as well. The only way we can get both the household ID and the donation information in the same list is by using a report; in other words, there is no individual object from which we can derive all of these bits of information. This is why we have chosen to create a report for the sublist's data source, rather than trying to use any of the objects directly: we will need fields from three different objects (Donation, Contact and Household) to populate the sublist.
  3. Next, we produce the list of households for which to generate letters. This can be done either via a report or directly from the Household object. For this example, we will use the latter approach. Click Apsona's Households tab and identify the households using a suitable filter, and select the households via checkboxes (if needed), as below.
  4. Click Tools - Merge/Mail to invoke the document generator, and select the document template alluded to above. In step 3 of the popup, match the fields of the template as below. There are a few key points to note in this mapping.
    • We have selected the report described above as data source for the Donations sublist.
    • We have set up a linkage so that the Record ID field of the Household object matches the field Opportunity Contact Role.Contact.Household (at the bottom of the above screen shot). This linkage is made possible because we included the Contact object's Household field in the report, and it ensures that only the donations made by one of the contacts of the household will be included in the generated letter.
    • We have mapped the TotalLastYear field to the rollup field in the Household object telling us the total amount donated by the household. This means, of course, that we are relying on the availability of that field. If you cannot rely on the availability of such a roll-up, you will need to use Apsona's multi-step reports feature to create a report that contains the total value, and use that report (instead of the Household object) to generate the merged documents.
  5. When we generate the letter, it will look like this. The screen shot below shows a total donation of $0 because the rollup field - which we rely on, as indicated above - is not correctly populated.