Managing personal office communication with MS Flow

It’s 10:00 am of a Wednesday and I am in my childhood home, having a chat with my dad and spending some time relaxing. As it is raining today, beach is not an option, and cinema is scheduled for later today.

So what better to pass the time until later than write a light post? So, instead of focusing on AIS or some “enterprise like” technology, I decided to talk about something I made to make my life simpler, using Microsoft Flow, Teams and Outlook – my ultimate out of office communication.

The requirements

For a bit of background, at Theta we had a long time tradition to indicate people whereabouts on email using a tag like OUT (out in a client), WFH (working from home), etc. That came from the time where the team was quite small and email was the main method of communication. With the team growing, earlier this year we made a request for people to move that kind of notification to Teams, on Theta’s General channel. But then I thought – why do I have to connect to teams to do that every time? There should be a better way…

In the end, the better way for me was a Flow button that allowed me to decide exactly what I wanted to do – I designed the flow to do the following:

  • Choose the type of notification I wanted to send:
    • Out of Office (OUT)
    • Working from Home (WFH)
    • Sick Leave (SICK)
    • Late to Work (LATE)
  • Have an optional text explaining the reason for the notification
  • Send an email to my manager indicating my whereabouts.
    • Optionally, send a copy of the email I send to my manager to a list of people I chose.
  • Optionally, turn on automatic replies and adjust the text and the duration of the automatic replies.

Flow Design

The flow is based on a manual input trigger Flow button (1) and perform the following actions:

  • Identify the Office 365 profile of the user running the flow (2)
  • Identify the Manager associated to that Office 365 profile (3)
  • Define the template of the message for MS Teams (4)
  • Define the template of the email to the manager (5)
  • Define is Automatic replies are required and define its template (6)

If you want to try this Flow yourself, you can get a copy here. Just import it and tweak it for your own requirements.

Flow Button input details

My Flow button is defined with the following inputs:

  • Notification type (required) – a dropdown with the values of notification types, based on the classic acronyms used to prefix the classic email comms at Theta .
  • Notification detail (required) – a free text for additional information or reason for the notification.
  • Return Date (optional) – a date field indicating when I am expecting to come back to work.
  • Create Out of Office (optional) – a boolean field indicating if I want to setup automatic replies (Out of Office) notification in Outlook.
  • Additional Notification People (optional) – a list of emails for people that I want to cc when sending a an email notification to my manager.

It is interesting to notice how rich the user experience can be when using the flow button. From required x optional field, to a set of different types of input controls, the flow maker have full control of what they are expecting to provide to the end user. That is another feature that differentiates MS Flow from Logic Apps.

User Input and Manager Definition

The actions to define the user and the managers are both provided by Office 365 and are called Get My Profile and Find My Manager, respectively. While Get My Profile doesn’t require any additional input, Find My Manager requires the User Principal Name (UPN), which is a property of Get My Profile. This will be required later, when email messages are sent to the manager.

Once the user and manager are defined, sending messages to teams, email and Automatic Reply are executed in parallel, so errors in one channel don’t impact the execution of the other channels, minimizing the chance of people not receiving my communication.

Sending Messages to Teams

Message to teams flow

The flow to send message to teams is based on a switch statement, which setup a variable – teamsmessagedetails – with the message to publish. I decided to make the WFH option – which I use the most – as the default option, so I end up initializing the variable with that value – for Flow it wouldn’t make any difference, but in Logic Apps that would make one less action execution, since you have to initialize the variable anyway.

Each case defines the message I wanted to publish, using the information provided by the flow button. The message is assigned tot the teamsmessagedetail variable.

To publish the message I am using the Post Notification in Teams action, updating 04 of their 5 inputs:

  1. Team – the team where the message will be posted. I am hard coding this to the Theta All channel, which is where we defined as the location to publish this type of notification.
  2. Channel – The channel where the message will be posted – as the Teams, I am hard coding this to General channel, as per our internal policy.
  3. Message – The message being posted – this value is filled with the value stored in the teamsmessagedetails variable.
  4. Subject – The “title” of the message – I’ve decided to use this optional value, with a concatenation of Notification TypeNotification Detail (e.g. WFH – Writing a Blog Post).

You could have created message with rich formatting if you wanted, since Post Notification in Teams action also accept HTML input. In this case, remember to change the Type parameter to HTML, instead of the default text.

Sending Email to Manager

The email to manager flow works just like the Teams flow – but I didn’t want to bother my manager with email, every time I was a bit late for work. So, like in the Teams flow, the variable emailmessagedetail was initialized with the WFH option, and a switch was created for SICK and OUT. In all cases, the email was sent using HTML (including CSS stylesheet for rich formatting).

To send the email to the my manager, I used the Send an Email action of the Office 365 Outlook connector.

  1. To – this field was populated with the Mail property of Find My Manager action setup at the top of the flow.
  2. Subject – subject was populated with a concatenation of the Notification Type and Notification Detail.
  3. Body – the body of the message receives the emailmessagedetail variable
  4. CC – the CC field is populated with the list of Additional Notification People from the flow button.

Setup Automatic Replies

Automatic replies differs a little bit from the other two options, because first I needed to decide if I wanted to create one or not – that decision was based on a boolean input in the flow button – Create Out of Office. Since the input was optional, I’ve created a boolean variable – createoutofoffice – and initialized it using the following function: coalesce(triggerBody()?[‘boolean’],false) – where ‘boolean’ is the name of the flow button input. This guarantee that if the value was not selected, the variable was set to false.

If the variable evaluates to true, the flow generates an out of office using the same pattern as the other two branches:

As per email to manager this flow initializes the variable oofemailmessagedetail with the WFH message, and setup either the SICK or OUT messages within a switch. Finally the flow uses the Set up Automatic Replies action from Office365 Outlook connector, with the following items:

  1. Status – Set the status to scheduled
  2. External Audience – Set to All (both internal and external)
  3. Start Time – For start time, I’ve used the utcNow().
  4. End Time – I’ve used the Return Date for End Time, which will turn off the Out of Office automatically at the date I’ve defined when trigger the flow.
  5. Internal Reply Message – For the internal message I’ve used the oofemailmessagedetail variable.
  6. External Reply Message – Since I didn’t want different messages for internal and external messages, I’ve also used the oofemailmessagedetail variable as the external message.


Voilá! With this flow, I can setup my whereabouts in Teams, send an email to my manager and other people that might need to know my whereabouts on any particular day, and setup my automatic reply all in one goal. The Flow button is available from the Microsoft Flow app for both Android and iPhone, so I have it handy anytime I want. I’ve already used it many times since I’ve setup the Flow, including during times where I had to be on a client site for a whole day and because of the morning commute I couldn’t have all of that communication setup for me. With a minute or so while waiting in the lobby of the client, everything was setup, including the automatic replies, so people would know that I would be late replying to their emails.

This is an example of personal productivity tool that can be achieved with Microsoft Flow. For sure, Microsoft Flow can do much more than just personal productivity, but for me this is an area where it is unbeatable, because there is no other tool that is as easily accessible and at same time as powerful in this space.

As a maker, you can create processes that are as simple as notify you when something important happens, to processes as complex as the one I’ve showed here that requires rich user input and orchestrate actions among multiple systems.

Sharing is caring...

One thought on “Managing personal office communication with MS Flow”

Leave a Reply

Your email address will not be published.