Let's start with stating that my 'workphone' is at work. Let's add to that situation that I have two young kids. If something is up during the morning and I'm running late, I want my team to be informed and I don't want anyone to invite me to any meetings during my unplanned absence. Makes sense, right? On the other hand I don't want to lose even more time telling my boss I'm late, sending messages to my teammates and opening my calendar, blocking the next hour or two. I fixed this, using Microsoft Flow.
The company I work for runs on Office 365, and MS Flow comes free with it (up until 750 flow-runs if I remember well), so I thought I would give it a try.
Works like a charm!
If you don't want to build the Flow from scratch, I made an export here. You can download it (json), and import it into your own MS Flow.
Basically, the steps that are required for building this Flow are quite simple, please keep these in mind:
Good to know:
Here we go!
First, visit flow.microsoft.com and login. In the left menu choose 'My Flows' and create a new one. It will probably at some point ask you to login/connect to Office 365, just follow the steps. You'll manage, I'm sure.
Once you're in your new Flow, click on the + sign to insert a new step>add an action. Search for outlook, click on 'triggers' (next to 'actions') and choose the trigger: 'When a new email arrives'.
This will be the trigger for your Flow to start.
For Folder, choose Inbox. For 'From' I set my private email-address, because that's where the trigger comes from. I usually don't have my workphone at home and I like to keep it that way.
Please notice that you also fill the option for 'Subject Filter'. In my case, I filled it with the word 'Later'.
Click on the + again, to add another action. This time, search for 'compose'.
If you click on the 'Inputs' line, the right formula-screen pops up. Just enter the formula below:
addHours(utcNow(),2)
This formula takes the current time and adds two hours. We just composed the end time of the event we will create in your agenda.
Repeat the last step, but now use the following formula:
utcNow()
As you propably guessed, this will be used as the starting time for the event.
Now, we create two empty Variables, using the 'Initialize Variable'. Give them the same names as in this example. You can leave the values empty since we don't have a default value (we will fill them in a later step).
Now we will create another 4 'Compose'-actions:
Salutation:
if(lessOrEquals(int(formatDateTime(utcNow(),'ss')), int(15)),'Hi Colleagues, ',
if(lessOrEquals(int(formatDateTime(utcNow(),'ss')), int(30)),'Oh Hi! ',
if(lessOrEquals(int(formatDateTime(utcNow(),'ss')), int(45)),'Hey there, ',
'Hey fellow nerds, ')))
This variable takes the seconds ('ss') from the current Date/Time, converts it into a number (int) and uses that number to determine the salutation based on that number falling within a range (between 0 and 15, etc). You can say that this is a way of creating a randomizer. There are many ways to do this, just be creative and see what works for you.
(Another way is covered at the step 'condition')
Seconds:
int(formatDateTime(utcNow(),'ss'))
This variable takes the number of seconds from the current DateTime. Why? The numeric value between 0 and 59 will be used later as a randomizer
I'm running late! If I missed my meeting with you, I'll plan a new one. Coffee's on me!
I'm sorry but I'm a bit late today. Please start without me!
Up until now, your Flow must look like this:
Now, we are going to create a 'condition', that uses the value from the composed 'Seconds'. Click the + again, and search for condition:
A condition checks if the given condition is True (yes) or False (no) and executes the corresponding actions. It looks like this:
For this condition, we'll use the value that is created in the formula of 'Seconds'. Basically, 'if output is greater than or equal to 30' execute the action under 'Yes', otherwise, perform the action from 'No'. This is one of many ways to 'randomize' certain values.
So, set the condition to use the Output of 'Seconds' (as shown below)
Next, set the 'is greater than or equal to' and the value of 30.
Under the branche 'if yes', create an action: ''set variable'
For 'Name', choose the variable 'text_body'
For 'Value', choose the Output from 'Compose text 1'.
Repeat the step above, but now for the branch under 'If no'. Make sure you fill the value with the Output of 'Compose text 2'. Your condition now looks like this:
Also, we must not forget to set the variable 'Salutation' with the random text we created:
Now it's time to create an event in your calendar. Add the action 'Create Event' and choose your calendar.
Set the subject.
Remember that we created two variables, named 'Starttime' and 'Starttime' + 2 hours'? Set the Output from these variables in the Start time and End time.
I like to receive a confirmation that the Flow ran fine, that's why I send myself a confirmation, and off course, don't forget to email your team. Just create two actions of 'Send an email'. One to yourself, one to your team and/or boss.
All set! Make sure you switch on your Flow. Just send yourself an email from your email address that you've set in the trigger, and use the correct subject.
You now have a workflow that sends emails to your team, having different texts each time.
Enjoy, running late was never this much fun!