Making and Uploading Mail Merge Templates - tsgrp/HPI GitHub Wiki

Setting Up the Mail Merge Template

  1. Start by opening a blank Excel sheet and title the columns with different fields which will be the values we populate on the form.
    • Think of these merge fields (the official name) as keys that we will fill out values on the form and populate the document with.
    • The Excel sheet is our data source used to populate the word document with.
  2. Save the workbook where it is easily accessible
  3. Next, open a new word document.
  4. Go to the “Mailings” tab at the top.
  5. Click the “Start Mail Merge” dropdown and select the “Step-by-Step Mail Merge Wizard…” option.
  6. Select the “Letters” radio button if it is not selected already for the first step, then hit next.
  7. Make sure the “Use the current document” is selected for step 2. Hit next after it is selected.
  8. For the third step, have “Use an existing list” and select next. This will open up a dialog to select a file and we will want to select the Excel sheet. Once selected it will show a screen and then select the sheet in the workbook that is set up with our merge fields.
  9. Confirm all the merge fields are in the next screen, then press “OK”.
  10. Press “next” until step six is reached then exit out of the wizard by clicking the “x” button.
  11. In the “Mailings” tab we can now add “Merge Fields” or do more advanced conditional statements.

Inserting Merge Fields and Creating Conditionals

Inserting Basic Merge Fields

  1. To start, make sure “Preview Results” at the top in the "Mailings" tab is not selected.
  2. The “<<[FIELD]>>” denotes a merge field.
    • E.g. <>, <, etc.
    • A field has to be inserted using the option at the top, one cannot be created by typing out the less than and greater than signs.
    • Press “Alt + F9” to switch between that style and mustache style. Mustache style is preferred if doing conditionals.
      • Mustache style looks like this for merge fields: {MERGEFIELD merge_field}.
  3. Inserting “Merge Fields” are pretty straight forward.
    • Put the cursor where the merge field should go. Click the "Insert Merge Field" dropdown and select the field that should go there.

Inserting Conditionals

  1. Conditional formatting can be really useful to show certain things or hide things to the user, be warned it can get messy the more complex a template has to be. Empty quotations for the true/false cases can be utilized to represent not showing something. The general format is like this: { IF {MERGEFILED xyz} [CONDITION] “If this is true.” “This this the else” }. Again, do not type this out manually.
  2. Start out by selecting the “Rules” dropdown in the “Mailings” tab. Then select “If…Then…Else”.
  3. Select the merge field that we should do the conditional on. Then select the conditional. Next, select the value it should evaluate the conditional on. Lastly, fill out the text that should display if this condition is true and if it is not.
  4. Within conditionals merge fields can be added in them. Example:
    • { IF {MERGEFILED payment_status} = "Payment Owed" “You owe ${MERGEFIELD amount}.” “Nothing is owed.” }
  5. To do more advanced formatting, line breaks can be added and additional if statements within other if statements (pay attention to where things start and end!).
    • When adding conditional statements, add them within the true or false portion of the "parent" or "next level up" conditional. Example:
      • { IF {MERGEFILED payment_status} = "Payment Owed" “You owe ${MERGEFIELD amount}. { IF {MERGEFILED payment_late} > "90" “You are 90 days late.” “” }” “Nothing is owed.” }

Uploading the Template in OCMS Admin

  1. Go into the admin in OCMS.
  2. Click “Template Management” under “Application Setup” on the left-hand side. Then click “Add a word document”.
  3. After the word document is uploaded click “Upload new word document”.
  4. Click the “Add Attributes” dropdown and select all the fields that are on the template.
  5. Lastly, hit the “Save” button at the bottom and then go make the form in the Wizard Admin! The form has to be the same name as the template.
⚠️ **GitHub.com Fallback** ⚠️