Investment requests – Email – Part 3/6

On 2018-09-18 I gave a presentation about the business solution “Investment requests” I created with: SharePoint Online (Modern team site), PnP PowerShell, Flow and PowerApps. The 45 minutes were over before I knew it. Several topics were not, or in lesser detail, presented. I therefor decided to start a blog post series specially for this.

The blog post series has the following topics:

  1. Introduction
  2. Executing Flow actions with service account permissions
  3. Email
  4. Permissions
  5. PowerApps
  6. And something more

Introduction

At several moments, an email is sent:

  1. to the person starting the approval process.
  2. to an approver.

Shared mailbox

When creating a solution, it is very much preferred to sent emails from a fixed email address. Using a shared mailbox to sent email is possible for this solution! When an employee starts the approval process, the “Office 365 Outlook” action is executed by the workflow account (See part 2 of this blog post series). The workflow account has permissions on the shared mailbox to sent emails. The Flow on the task list was created by the workflow account. When a new item was added, or an existing one was updated, the actions run as the workflow account, again having access to the shared mailbox to sent email.

The shared mailbox has the same name as the solution (“Investment requests”) and it was proposed to work this way for all solutions (processes in SharePoint Online). This way, approvers can easily see that a task has been created for them by this process. They can even make Outlook rules.

Templates

Working with email templates which are stored outside a Flow has as advantage that corporate styling updates can be implemented without having to change a Flow. This is often regarded as a less impactful change than changing a Flow. Email templates also support: Create once, use often.

For this solution, I created a SharePoint list called “Settings” containing several columns among a “Multiple lines of text” column. This field contains the email template. Every email template has a specific value in the column “Title”. In total 7 different email templates were created:

  1. Email to the initiator when fields are empty.
  2. Email to the initiator when a wrong (sub)category is chosen.
  3. Email to the initiator when a file with that name already exists in the document library “Requests”.
  4. Email to the initiator when the approval request Flow is successfully processed.
  5. Email to an approver.
  6. Email to the initiator when the investment request is approved.
  7. Email to the initiator when the investment request is declined.

A few email templates have one or two variables. I choose a a double curly braces setup for variabels. A screenshot is show below.

Because this email was sent as HTML email, a few HTML elements were added to create some spacing.

In the created Flows, an email is sent with the following actions:

  1. SharePoint – Get item
  2. Set variable
  3. Set variable
  4. Office 365 Outlook > Send an email from a shared mailbox

The “Set variable” actions are only used when variables need to be replaced. A screenshot is given below.

This specific case was about sending an email when an approval request was declined. Two variables were used: The unique ID of the request and the comment of the approver who declined. When an approver choses “Decline” (PowerApp SharePoint form), a comment has to be filled in.

Related topics

A goal was to keep the amount of emails to a minimum. This can be seen as a best practice for all solutions.

An approver gets an email containing two links:

  • Link to the document in the document library “Requests”.
  • Link to the task in edit mode.

This way, the approver does not have to go to SharePoint to check if a task is available for him/her. The task is in “edit mode” to minimize the number of clicks for an approver.

Leave a Reply

Your email address will not be published. Required fields are marked *