For admins and template authors: build a Generate Receipt button on a custom Receipt object that creates a numbered PDF receipt for a payment, with the payer's details, the amount paid and the balance still due, and saves it to the receipt's Files. It takes about 30 minutes, including creating the object.

What you'll build

For a sample receipt of a $20,000 payment against the Burlington Textiles Weaving Plant Generator opportunity, the receipt reads:

RECEIPT RCT-0007 · Date: 11/20/2026 Received from: Burlington Textiles Corp of America, Burlington, NC 27215 For payment of: Burlington Textiles Weaving Plant Generator · Paid by: Check

Opportunity amount$62,000.00
This payment$20,000.00
Balance due$42,000.00

Balance remaining: $42,000.00. Thank you for your payment. The file is saved as Receipt RCT-0007.pdf.

It uses these features:

All of these work in both Basic and Pro.

Before you begin

  • Docs Made Easy is installed and you have a license and the permission set. See Assign licenses and permission sets.
  • You can open Document Setup, create custom objects and fields, and edit page layouts.
  • You have an account with a billing address and an opportunity with an Amount, to test with.
  • Your org has a Receipt custom object. If it doesn't, create it in Salesforce Setup > Object Manager > Create > Custom Object:
    • Label Receipt, Object Name Receipt (API name Receipt__c).
    • Record Name Receipt Number, Data Type Auto Number, Display Format RCT-{0000}. Auto Number keeps receipt numbers unique without anyone typing them.
    • Select Launch New Custom Tab Wizard after saving this custom object, so users can open receipts from a tab.
  • On Receipt, create these fields in Fields & Relationships > New:
Field labelData typeAPI nameHolds
AccountLookup Relationship (Account)Account__cWho paid
OpportunityLookup Relationship (Opportunity)Opportunity__cWhat the payment is for
Receipt AmountCurrencyReceipt_Amount__cThe amount of this payment
Balance DueCurrencyBalance_Due__cWhat is still owed after this payment
Payment MethodPicklist (Cash, Check, Card)Payment_Method__cHow the customer paid

If your org already has a receipt or payment object, use its fields and copy their tags from the Merge Field Helper.

1. Build the template

Download the sample template (.docx), ready to upload, or create a Word document with the content below. Replace anything in [square brackets] with your own details.

RECEIPT {{Receipt__c.Name}}
Date: {{Receipt__c.CreatedDate \@ "MM/dd/yyyy"}}

Received from:
{{Receipt__c.Account__r.Name}}
{{Receipt__c.Account__r.BillingCity}}, {{Receipt__c.Account__r.BillingState}} {{Receipt__c.Account__r.BillingPostalCode}}

For payment of: {{Receipt__c.Opportunity__r.Name}}
Paid by: {{Receipt__c.Payment_Method__c}}

[Word table: 2 columns, 3 rows, aligned right.]
| Opportunity amount | {{Receipt__c.Opportunity__r.Amount \# CurrencyCulture1}} |
| This payment | {{Receipt__c.Receipt_Amount__c \# CurrencyCulture1}} |
| Balance due | {{Receipt__c.Balance_Due__c \# CurrencyCulture1}} |

{{IF|Receipt__c.Balance_Due__c|GT|0}}
Balance remaining: {{Receipt__c.Balance_Due__c \# CurrencyCulture1}}. Thank you for your payment.
{{ELSE}}
Paid in full. Thank you for your payment.
{{ENDIF}}

Received by: {{Receipt__c.CreatedBy.Name}}

To turn this into a Word template:

  1. Paste the text into a new Word document. Replace the [Word table …] block with a real Word table that has the same rows and cells.
  2. Keep each tag exactly as written, in one piece.
  3. Check the API names against your org. When you upload the template in step 2, open the Merge Field Helper, select a lookup field such as Account Id to see the account's fields, and check that each tag matches, for example {{Receipt__c.Account__r.BillingCity}}. See Where to get merge fields.

The IF block shows the remaining balance when Balance Due is more than 0, and "Paid in full" otherwise. Every {{IF}} needs its {{ENDIF}}.

{{Receipt__c.CreatedBy.Name}} merges the name of the user who created the receipt. The Merge Field Helper offers standard lookups such as Created By on custom objects too.

2. Create the solution

  1. In Docs Made Easy, open Document Setup and click Launch Wizard.
  2. On Add Details, enter Generate Receipt as the Button Name, select Receipt and click Create. The Gather Data page opens.
  3. Click Next. The template reads the account and opportunity through the receipt's lookup fields, so you don't add anything here.
  4. Click Add templates and choose Upload a document (before v1.25: Create New Document Template). Use the Merge Field Helper to check the receipt and lookup tags.
  5. Enter Receipt as the Template Name, upload your Word file and click Save. Click Next. The Assign Behaviors page opens.

Each wizard screen is described in Create a template with the Document Automation Wizard.

3. Set the behaviors

On the Assign Behaviors page, set the following. Click Save in each section, then click Next.

SectionSettingValueWhy
Generated FileConvert to PDF?OnCustomers get a receipt they can't edit.
Generated FileFilenameReceipt {!Receipt__c.Name}Each file is named after its receipt number, so it's easy to find.
Background ModeWould you like to enable background mode?On, with File (bgm=1)One click saves the PDF to the receipt's Files and downloads a copy.
Other ParameterCurrencyCulture1en-USFormats the amounts as US dollars with separators and two decimals, for example $20,000.00. Use the culture code for your currency.

The space in the file name is kept, and .pdf is added automatically, so the file is saved as Receipt RCT-0007.pdf.

4. Add the button

  1. On the last wizard page, click Go to Page Layouts and open Receipt Layout.
  2. From Mobile & Lightning Actions, drag Generate Receipt into Salesforce Mobile and Lightning Experience Actions.
  3. Click Save.

If users don't see the button, see Users can't see or use the button.

5. Generate and check

  1. Create a receipt: pick an account and an opportunity, and enter 20000 as Receipt Amount, the remaining amount as Balance Due and a Payment Method. Save it.

  2. Click Generate Receipt. Background mode skips the Composer page, and the PDF downloads.

    Generate Receipt button on the Receipt record

  3. Check the receipt against the record:

    • The receipt number matches the record's Receipt Number.
    • The account name and address come from the account, and the opportunity name and amount from the opportunity.
    • The amounts show the currency symbol for your CurrencyCulture1.
    • With Balance Due more than 0, the remaining balance is shown. Set it to 0, generate again, and "Paid in full" is shown.
  4. On the receipt's Related tab, open Files. Receipt RCT-0007.pdf (with your receipt number) is listed.

Troubleshooting

What you seeFix
An account or opportunity value is blank, or a tag such as {{Receipt__c.Account__r.Name}} shows as textThe lookup is empty on the receipt, the API name is wrong or you can't see the field. Copy the tag from the Merge Field Helper. See Merge fields are blank or show as text and DME-SF-002.
An error says the object doesn't exist or isn't accessibleYour profile or permission set can't read Receipt or one of its fields. Grant access in Salesforce. See DME-SF-003.
Amounts have no currency symbol, or the date is in the wrong formatAdd CurrencyCulture1 as an Other Parameter and \# CurrencyCulture1 to each amount tag; check the date pattern's letter case. See Wrong date, number or currency format.
"Paid in full" never appearsBalance Due is empty or above 0. The IF compares the field with 0, so enter 0 when the payment clears the balance.
The PDF layout differs from the Word fileFonts or floating objects change in conversion. See The PDF looks different from my Word template.

Take it further