Mail Merge Workflow
Last updated 25/01/2024
In the AIS application there are three mail merges, when a Submission form is submitted an email will be sent to the Finance department to approve or reject, once the Finance department has made a decision an approved or rejected mail merge will be sent.To enable this workflow, 3 functions, a process and a URL will also need to be created.
Figure 1 - Mail merge workflow
DoNewSubmission Function
TheDoNewSubmission()
calls the Submission Received mail merge and sends an email to the Finance department when a new submission has been submitted. It will go through the transactions from the Submissions form and creates an array of attachments to be merged into the mail merge.The
DoNewSubmission()
is attached to the Do Complete event on the Submissions form and will execute when the Save button is clicked on the Submissions form and sends the Submission Received mail merge to the Finance department.DoAddSubmissionAttachments Function
Before the Submission Received mail merge can be created we need to have the ability to attach attachments to the Submission Received mail merge. TheDoAddSubmissionAttachments()
will attach the documents that are attached to the Submissions form to the Submission Received mail merge.The
DoAddSubmissionAttachments()
is attached to the Do Merge Record event on the Submission Received mail merge and will execute when the Save button is clicked on the Submissions form and merges the documents into the email before the mail merge is sent.Submission Received Mail Merge
Two links are available in the Submission Received mail merge, either to approve or reject the submission. These links are created manually using thevariable
property on the Five
object and they will access an external URL called approval which will take the SubmissionKey and Status fields as parameters to know the updated status of the submission.Submission Approved and Submission Rejected Mail Merges
The Submission Approved and Submission Rejected mail merges are called by theSubmissionApproval()
and sends the required mail merge depending on whether the submission is approved or rejected.SubmissionApproval Function
TheSubmissionApproval()
will flag the submission as approved or rejected in the database and calls either the Submission Approved mail merge or the Submission Rejected mail merge and sends the required mail merge to all email addresses added to the Submissions form.ProcessSubmissionApproval Process
TheSubmissionApproval()
is attached to the Do Run event on the ProcessSubmissionApproval process and will execute when the approval URL has been clicked in the Submission Received mail merge.approval URL
The approval URL will reference the ProcessSubmissionApproval process and updates the status provided by the link in the Submission Received mail merge and sends out either the Submission Approved mail merge or the Submission Rejected Mail Merge.Steps to Add the Mail Merge Workflow
1. Add theDoNewSubmission()
function and attach to the Do Complete event on the Submissions form.2. Add the
DoAddSubmissionAttachments()
function.3. Add the Submission Received mail merge and attach the
DoAddSubmissionAttachments()
function to the Do Merge Record event on the Submission Received mail merge.4. Add the Submission Approved mail merge.
5. Add the Submission Rejected mail merge.
6. Add the
SubmissionApproval()
function.7. Add the ProcessSubmissionApproval process and attach to the Do Run event on the ProcessSubmissionApproval process.
8. Add the approval URL and reference the ProcessSubmissionApproval process.