How can you perform a more complicated automation with Microsoft Flow? This example will show how you can use multiple conditions to cause Flow to perform a variety of actions based on what you choose in an approval email.

Background on Flow:

A while back I created an automation with Flow which creates a tweet based upon when specific hashtags are found and the tweet is approved. The original Flow information is available at: https://www.catapultsystems.com/cfuller/archive/2016/07/01/applying-automation-and-approvals-to-twitter-with-microsoft-flow/

I have also created a couple of other templates and at least one of them were accepted by the Flow team (shown below):

(This template is available here) and originally blogged about it here).

Creating an approval process with multiple potential actions:

The focus of this blog post is to show how an approval process can result in multiple potential actions. We start by creating a custom template. In the template we start with a “When a new tweet appears” action which has a search text of “#MSOMS OR #SCOM – -RT” (show me any tweets with the hashtags of #MSOMS or #SCOM which are not retweets).

Next we get the user information who it was tweeted by:

And then we send the approval email. The tweet indicates that the email is being sent regarding twitter, it contains the tweet text and provides a notification on who originally tweeted this. The user options are three in this case: CoPTwitter, Twitter, No. What these conditions mean will make more sense as this blog post goes on.

Next we add a condition. Where the SelectedOption (taken from the approval email) contains the value of Twitter. This means that in this case the value would be correct if it was either CoPTwitter or Twitter.

If the condition is Yes (IE, it contained Twitter) then it posts the tweet. [Please note, it would be better to just re-tweet the original tweet but that isn’t currently an option apparently due to restrictions from Twitter)]

We can add another condition which indicates that the approval also included the value CoP (Community of Practice). This would occur only if the approval option chosen was CoPTwitter (since we are down the path from having contained Twitter and now we are looking for the value CoP).

If this value is Yes (that the approval included the letters CoP) then it sends an email to the CoP distribution list with the format shown below.

The unexpanded Flow looks like this:

Summary: Microsoft Flow provides the ability to make some relatively complex automation occur which can include approvals and multiple potential actions based on that approval. In this example, relevant tweets can be approved and automatically tweeted and emailed to an appropriate distribution list.