How to mail merge using email and PDF receipt

Emails with PDF attachments can be generated by a special type of email called Visualforce Emails. This email can be used for receipts, membership renewal notices and membership confirmations.

Quick Step Notes:

The details merged are vary for the different PDFs being generated.  

All templates will allow for mail merge of Salesforce User details and Organization details.

  • For receipts, details are merged from the Payment Txn object
  • For Membership Renewals notices or Membership Confirmations, these details are merged from the Subscription or Account Subscriptions that is related to the membership.

For receipts, the text for the body is stored in the Campaign  Receipt Text, Payment Form  receipt text or the Merchant Facility Receipt Text.

For membership confirmations and membership renewal notices, the body text is maintained on the Payment Form.

The simplest way to create the mail merge fields is to use the standard Salesforce Email template maintenance and then copy/paste that text into your Receipt text located in the Payment Form.

1. Find merge fields for email

Classic - Setup > Administration Setup > Communication Templates > Classic Email Templates

Lightning - Setup > Administration  > Email > Classic Email Templates

1.2. Select 'New Template' button

1.3. Select the type of email template you'd like and press NEXT

1.4. Enter details for your email template

1.5. Select the Field Type or location where your fields reside

Use Payment Txn Fields for transaction details and Subscription Fields or Account Subscription Fields for membership details

1.6. Select the field and Copy/Paste the field into your email template

1.7. Copy the Email Body text

2. Place merge fields into your email

The Merchant Facility tab can be found within the Payments2Us menu (Top right picklist in Salesforce - Select Payments2Us), or it can be found under the "More" at the end of the tabs. (In Salesforce Classic - It can be under the "+" at the end of the tabs)

Once you have clicked on the Merchant Facility Tab, select the appropriate List view (Example - "All Merchant Facilities") and click into Merchant Facility you wish to update.

2.2. Scroll down to Payment Forms and select your online form

2.3. Select Receipt Template tab and select the Edit button

2.4. Paste the text (copied from the email template) into the Receipt Text field and SAVE

3. Test your email

3.2. Select the Receipt button

3.3. View PDF receipt with merged fields

View PDF receipt with merged fields