Skip to main content

Add a Mail Merge Using a Function

Last updated 1/02/2024

A mail merge can be created using a function and inside this function you can add a SQL SELECT statement to return fields from your database. For this example, a function will be created to look for employee birthdays. If their birthday matches the current date an automated mail merge will be sent to all employees for their birthday.

The following steps need to be performed:
  • Create your mail merge record
  • Add your function
  • Attach the function to a process on the Do Run event
  • Create a menu item for the process
  • To automate the mail merge, create a job instead of menu

Add a Mail Merge

info
When you add a mail merge that uses a function you do not need to provide a data source as the Mail Merge will use your function.

1. Click the Add Item button.

2. Type a title in the Title field.

info
The SMTP From Name and SMTP From Email fields are not required here on the Mail Merge form as they are using the values in these fields on the Instances form.

3. Type a subject line in the Subject Text field.

4. Click in the Merge Text field.

5. Use the icons in the toolbar to select your fields and design your template.

info
You need to manually type your placeholders in the template when using a function. The values passed through as the context to the
executeAction()
will be merged into the
variable
property on the
Five
object.

6. Click the Save button in the editor app bar.

7. Click the Save button in the form app bar.

1. Select Logic in the menu.

2. Select Code Editor in the sub-menu.

Add Your Function