Just starting out with Microsoft Flow? If you don’t know about Flow, it’s great for orchestrating a workflow or automating the mundane into an easy to use environment. It can also be used for integrating a workflow into things like PowerApps or Power BI.

In this demo, I’ll show you how to get started and build a simple Flow:

First, I open my Flows and although I already have some Flows created, I want to create a new one, so I click on New at the top and then Create from Blank.

There are many great templates available and chances are you can find what you want. Simply search for something, like Twitter for example, and you’ll get a list of pre-built templates that you can configure to match your requirements.

For this demo, I’m keeping my user requirements simple; I want to find out who is Tweeting about a certain hashtag. I use #fortnite as it has a lot of Twitter traffic.

My goal here is if someone has more than 100 followers, I want to log that Tweet into our analytics database.

Once I’ve clicked Create from Blank, Flow needs a triggering event, in other words, when this particular thing happens, do these series of other things. So, there are triggers, and there are actions for those triggers.

In this case, I click on the Twitter icon to search and I find one triggering event, when a Tweet happens. I click on that event and I add the search terms or hashtags for this example that I want to monitor for, #fortnite.

We can use this Flow to determine the kind of social media traction we have – Are people talking about this? We also could measure this Tweet with machine learning to find out if this is a positive/negative Tweet.

Now that I have a triggering event, I double click on the title box and give my Flow a title (Fortnite Tweet Logging) and now we can do analytics on this.

Next, I’ll save that Tweet conditionally to SQL Server:

First, I hit Next and add my condition – if there are more than 100 followers, log it, otherwise leave it alone.

I go under Control and use the Condition option and select the Choose Value Box for an ‘if’ condition. We’ll see the condition statement is started for us - When a new tweet is posted - as well as a list of all the different columns available to me.

Another thing it’s doing is tracking the data types and making sure they match as well.

I choose ‘Number of followers’ for the first field in my condition, then ‘if it’s greater than’ and my value (100) in the next fields.

From there, I’ll log that Tweet in a SQL Server so my marketing team can go through and analyze that.

Below the Condition pane, you’ll see two panes for Yes and No, which way it goes being decided by whether the tweet had 100 followers.

For this one, I’m going to ignore the No pane, but I’ll add an Action in the Yes pane. I can add Actions such as: log the tweet into a SQL Server or follow the person and send out an automated marketing campaign or even direct message them. You could also set delays in here.

I’m going to set my Action to log into a SQL Server by typing SQL Server in the Action search bar, then I’ll log into a SQL Server table and add a new row.

Next, it will ask which table I want to go to with a pull-down list of tables already out there. My connection is already here because I’m using that same environment inside PowerApps; as you build these connections, it works across platforms – another nice thing about Flow. If I didn’t already have a connection, I would simply click ‘add new connection’.

Under Dynamic Content, I’ll need to fill in the fields: my table name, Tweet ID, the owner and username, the actual Tweet itself, location, friend count and follower count, then Save. Flow is smart about data types, if it knows it can’t work on certain data types, then we won’t see that message on our pull-down list.

You can also click inside the fields and you’ll see the Expressions tab in the Dynamic Content pane. Here, we can use expression language in Flow and PowerApps to massage our data. If you know the languages for what you can do in PowerApps, you can also do most of the same in Flow as well.

That’s it – we’ve created our first Flow. Once it’s running, I see I’ve had a few successes and if I run this query again in my table, I see this is a very active Tweet and our first Flow is now complete.

I can also modify this by going into the Edit button at the top and add some additional things like change my condition by adding a new Action. I could add Get User Information to get more info on the user. I could also go through and add more dynamic content and tie things together. Remember, if you don’t find what you’re looking for in the pull-down, it could be that that data type doesn’t match.

There you have it, this demo showed you how easy it is to build your first Flow. There’s a lot you can do with Flow, so keep an eye out for future videos on our You Tube series and for blogs that get into more detail.

If you want more in-depth training on Flow, we have courses covering Microsoft Flow and PowerApps in our On-Demand Learning platform, as well as over 50 courses on Business Intelligence, Azure, Power BI and much more! Click the link below to get your free trial today!

Join Our Blog

Join thousands of other SQL Server, BI and cloud pros by subscribing to our blog.

Leave a comment

SQL Server MVP and founder of Pragmatic Works. Brian has been working with SQL Server as a DBA and business intelligence professional since 1998. He has written more than 15 books on the topic and has spoken at dozens of conferences.