Automating Sick Leave Notifications (O365)

calendar_month November 20, 2020

I love automating, recurring tasks should be automated – that’s one of my mottos. IFTTT, Zapier, n8n or Power Automate (formerly Microsoft Flow) can significantly make our lives easier when it comes to automation. In this post I show how I automated the sick leave notification for my son’s school.

The Case – UseCase

My oldest started school in September 2020 as a first grader. Everyone who experienced 2020 knows it was a difficult and unusual year. 2020 was under the Covid-19 shadow, and schools were no exception.

The school naturally wants to be informed in case of illness. The usual channels are offered via phone, fax, and email, with email being noted as “preferred as additional info”.

We had a case of illness, so mom and dad had to report it. In this case I opened my mail app on my smartphone, wanted to enter the recipient… that’s where the problems started:

  1. Open email app
  2. Enter recipient (this information was missing)
  3. Search for recipient → not saved
  4. Search for document shared by the parent council
  5. Found in WhatsApp, open in PDF viewer
  6. Copy out the email address
  7. Paste the email address
  8. Paste subject: Sick leave '[First name Last name]' Class '1x'
  9. Paste body/text
  10. Send

Too much time lost – I knew it could be easier. At my employer it’s similar with sick leave notifications, I have a flow there that with one click in the app does exactly that. Now I wanted to set that up for our son’s sick leave notifications too.

What’s Needed

As a rule, all the above-mentioned and other automation tools can be used for this requirement. In this case I use Power Automate (Flow).

What’s needed:

  • M365 account (can also be from an M365 Single/Family subscription)
  • Recipient email (e.g. info@school.de)
  • Parents’ email

The Flow Trigger “Instant”

As long as our children haven’t had a bio-health-tracker implanted, it will be a manually triggered event. For this, Flow offers a trigger with buttons that can be triggered directly with a click from the Flow app, for example. The app is available in both the Play Store and App Store.

This is the so-called Instant/Sofort trigger. When you create a flow with this trigger, a button with the flow title appears in the mobile app, for example.

The Variables

We will use variables for our flow. The following variables are defined:

NameTypeValue
Recipient: EmailStringrecipient@school.de
Child: NameStringMax Mustermann
Child: ClassString1A
Parents: EmailStringparents@email.de
Parents: InfoStringTel: 0123, Mail: parents@email.de
Date: TodayString(set via Expression)

Today’s Date as Expression

Adding this variable is analogous to the others, the only difference is that we don’t enter a static string as the value, but a formula as an Expression:

formatDateTime(triggerOutputs()['headers']['x-ms-user-timestamp'], 'dd.MM.yyyy')

Send Email

Now we come to our final action: sending the email. For this we use the “Send an email (V2)” action.

Variables in Subject and Text

Subject:

Sick leave notification @{variables('Child: Name')} Class @{variables('Child: Class')}

Content:

Dear Secretarial Team,

unfortunately we have to report that '@{variables('Child: Name')}' - Class '@{variables('Child: Class')}' - is sick for today (@{variables('Date: Today')}).

Kind regards,
------------------------------------------------
@{variables('Parents: Info')}

Special Flow for Parents

For the parents of my son’s classmates I created a different package. The advantage of the separate package is that after importing, only the contactInfo and mailOfParents need to be adjusted. The rest is retrieved via the User Profile (name and class of the child).

For this, the “Office 365 User” connection must be set up before importing.

Then the package can be imported via the Import menu under “My Flows”.