Learn how to build flows that copy and collect data, as well as flows that send notifications. Run your flows based on a schedule or on-demand from a button.
Create a button flow
In this topic, you will learn how to build a button flow for the Contoso Flooring Company.
Button flows can be used to send email to a team and alert them of tasks to perform. Ownership of the flows can be assigned to one worker or shared by multiple members on a team.
First, go to the Microsoft Flow website and sign in.
Once you are done signing in, select My Flows, and then Create from blank.
The first thing you'll need is a trigger. The button flow is a convenient one to use.
If it's not there in your list, select Search hundreds of connectors and triggers at the bottom of the page, enter button, and it will pop up for you.
Select Flow button for mobile.
Select Flow button for mobile - Manually trigger a flow.
On the input screen, select Add input text,
Enter Contoso Flooring in the first text box, and Warehouse delivery email in the second text box.
Select New step.
Select Add an action.
Select the Office 365 Outlook connector. If it isn't there, search for outlook.
Select Office 365 Outlook - Send an email.
When the button is pressed, an email is sent to the whole Contoso Warehouse team, no matter where they are in the building, letting them know that the delivery has arrived.
Expand the fields and customize the email to work for Contoso Flooring.
In the To field, enter an email address that is valid in your organization.
In the Subject field, enter Delivery Arrived.
To the right, notice a Dynamic content box popped up. To show, in the subject line, the exact date and time the button was pressed, select Date and Timestamp.
Now, enter a simple Body for the email saying something like, Warehouse Team, please come to the unload bay as todays delivery has arrived.
Select Create flow to save the flow.
Create a team flow
You can use this button flow as an example of how to create a team flow. What if the creator of this flow is out sick? What if she leaves the company? You want to make sure that this flow keeps running. To do that, add co-owners.
Select the team icon on your flow to add a co-owner.
Enter names, email addresses, or user groups to add co-owners.
To remove co-owners, select the trash can to the right of their name.
Select Remove this owner to finish the removal.
In this lesson, you've seen how to create a button flow.
In minutes, the flow gave a warehouse worker the ability to alert her team to a delivery arrival, so that the team didn’t have to stand around and wait, wasting valuable time they could spend on other tasks.
The worker then shared that button out to her team, so others could trigger the same flow if she wasn’t around.
Check out the next lesson to see how to create a flow that uses push notifications.
A common use of Microsoft Flow is to get a notification when something happens. Notifications can be emails, text messages, or push notifications on your phone.
It's easy to create a flow that sends push notifications to your mobile device. You can create the flow in the mobile app or at flow.microsoft.com, but you'll need the mobile app to receive push notifications. The Microsoft Flow mobile app is available for Android, iOS, and Windows Phone.
If you are using an unsupported mobile device, consider using SMS messages (texts) to receive notifications instead of push notifications.
Creating flows that send notifications
You can use a template, like in the video above, or you can use the Send a push notification action when creating a flow from scratch. You can include dynamic content from other actions or triggers.
Now that you've seen how to receive notifications, let's look at using Microsoft Flow to copy files.
Today, it's very common to use a file storage service, such as OneDrive or Google Drive. Have you ever needed to copy files from one storage service to another? Microsoft Flow makes it easy to automatically move and copy files between two services.
Creating flows that copy files
You can use a template, like in the video above, or you can create a flow from scratch. Different services have different details and parameters in their actions. In the video, we showed you copying a file from OneDrive to OneDrive for Business. Here's another example we created from scratch to copy from OneDrive to DropBox.
Next, we'll look at how you can collect data from services.
In addition to being able to get notifications and copy files, Microsoft Flow also enables you to collect data. This can be useful for analytics, like with Power BI.
Sources and destinations, triggers and actions
When collecting data, your trigger can be any of a variety of services, such as Twitter, your Office 365 Email, or the Common Data Service. Each one of these services has their own dynamic properties that represent fields you can populate in your destination.
Some common destinations you can store data in include Excel, SQL Server, SharePoint lists, and Google Sheets. You can also use the Common Data Service.
Now let's learn how to post tweets based on data in a SharePoint list.
Post tweets from a flow
For this flow, you'll build a SharePoint list where the Marketing team for Contoso Flooring stores their Twitter posts and posting dates. From there, you will build a flow that will auto-Tweet the content for them.
Connect Microsoft Flow Services
In this topic, you'll be using the SharePoint and Twitter services. If you are using a service that's new to you, then you'll first need to connect to the new service.
In Microsoft Flow, select the gear icon, then Connections,
Select + Create connection.
Scroll down the list, find Twitter, and select +.
To authorize a Twitter account, enter your username or email, and your password, and then select Authorize app.
To check your connections, select the gear icon and Connections.
You should see your new Twitter connection and any other connections you have created.
Build a SharePoint List
The first thing you need to do is create a new SharePoint Online list for Contoso Flooring.
In SharePoint Online, select New, and then List.
Name the list Contoso Tweets.
Clear the Show in site navigation check box, and select Create.
When you select Create, SharePoint takes you to your new list.
By default, the list has a single column - Title. Add another column and name it Tweet Contents. The things that you’ll say in your tweets will go here.
Select the plus sign, then select More...
Select Multiple lines of text, then select OK.
Add a column for the tweet date and time, and name it Tweet Date.
As with Tweet Contents above, select the plus sign, then select More...
Scroll down to Date and Time Format. Select Date & Time, so that both are included.
Select OK. You see the Contoso Tweets list in your SharePoint site, and you can add new items to the list.
Build the flow
Your list is built, so now you can build the flow.
Choose a trigger
In Microsoft Flow, go to My Flows, then select Create from blank.
Select When an item is created.
We want our trigger to fire when a new row is added with tweet content.
Select your SharePoint site, then select the list that you set up earlier, Contoso Tweets.
Okay, that’s it for the trigger.
Add an action to delay posting
Select + New step, then select Add an action.
Under the Schedule service, select Delay until.
Set the delay value.
Click or tap in the Timestamp field.
When the dynamic content box opens, scroll down to the bottom, and you see the three columns from the SharePoint list: Title, Tweet Date, and Tweet Content.
Select Tweet Date.
Now, when someone adds something to your SharePoint list, it will delay any action until the date and time you set in the Tweet Date column.
Add an action to post a Tweet
Now you'll add another action for the flow to take at the date and time specified in the Tweet Date column.
Select + New step, Add an action, then search for Twitter.
Choose the action, Twitter - Post a tweet.
Click or tap in the Tweet text field, and in the dynamic content box, select Tweet Contents. Here's the sequence you have created.
Select Create flow...
Now the flow is complete.
When a new item is created in your SharePoint list, the flow will delay posting until the pre-set date. When that date is met, the flow will post to Twitter with the text from the Tweet Content column in your list.
In the next lesson, you'll learn how to run flows on a schedule using a trigger called Recurrence.
Create scheduled flows
In this topic, you’ll see how to run pre-scheduled flows using a trigger called Recurrence. You’ll build a flow for the Contoso marketing team that automatically pulls customer email addresses from an Excel table on OneDrive. You’ll configure the flow so that once per day, new email addresses that were added to the spreadsheet are then added to a MailChimp customer list.
Create a scheduled flow
Open Microsoft Flow, select My flows, and then select Create from blank.
Select Search hundreds of connectors and triggers.
Search for the Schedule service, select it, and then select the Schedule – Recurrence trigger.
Set Frequency to Day, and Interval to 1. Select New step, and select Add an action.
Search for Excel, select the Excel service, and select the action Excel – Get Rows.
Note: Be sure to select Get rows, not Get row.
Select File name and navigate to your file location. Select Table name and select the desired table in the spreadsheet.
Add a new action.
Search for the MailChimp service, then select the action MailChimp - Add member to list.
Note: MailChimp is a premium connector. Depending on your Microsoft Flow license, you might need to sign up for a trial to use this connector.
Add the List Id and Status fields from the dropdown menus:
List Id – Select your desired MailChimp mailing list
Status – Select Subscribed
In Email Address, use the dynamic content feature to add the ContactEmail field.
Notice that the flow automatically creates an additional step. Flow detects that you are going to set an action that requires an additional action. Whenever the flow reads a new email address, it will also create a new action for each row.
Use dynamic content to fill in the First name and Last name fields:
First name – FirstName
Last name – LastName
Now this flow will run once a day and get new rows from this Excel table, grab the email address and name, and use them to populate the MailChimp Contoso mail list, saving you both time and money.
Convert and store documents
In this topic, you’ll see how Contoso Flooring uses Microsoft Flow to automatically convert documents to a standard format and then store them in SharePoint Online for safekeeping in the cloud. You'll create a flow that detects when a new file has been added to a OneDrive for Business folder, and then converts that file to PDF and stores it to a SharePoint Online folder.
For this scenario, you’ll need an account with Muhimbi, a PDF conversion service. If you don’t have a Muhimbi account already, you can sign up for a free 30-day trial. Follow the instructions on that page for deploying the app through your SharePoint Online site.
Create the source and target folders
First, you need to create the source and target folders on OneDrive for Business and SharePoint Online.
In OneDrive for Business, under Files, create a folder named Finished Documents.
In SharePoint Online, in Shared Documents, create a folder named PDF – Finished files.
Create the flow
In Microsoft Flow, select My Flows, and select Create from blank.
Select Search hundreds of connectors and triggers.
Search for OneDrive, select OneDrive for Business, and then select the trigger OneDrive for Business - When a file is created. In Folder, select the folder icon and select the Finished Documents folder that you created in the previous step.
Select New step, and then select Add an action.
Search for Muhimbi, select the Muhimbi PDF connector, and select the action Muhimbi PDF – Convert document.
At this point, you may be prompted by Microsoft Flow to authenticate to Muhimbi. You will need to register Muhimbi using your SharePoint tenant ID in order for Microsoft Flow to use the Muhimbi service.
To find your tenant ID, select the Settings gear icon in SharePoint Online, and select Site settings.
Under Site Collection Administration, select Site collection app permissions. Your tenant ID is the identifier that follows the “@” symbol in any of the app listings.
In the Convert document action, set the following values:
Source file name: From the dynamic content list, select File name.
Source file content: From the dynamic content list, select File content.
Output format: From the dropdown, select PDF.
So far, you’ve configured your flow with the following steps:
- The flow is triggered whenever a new file is added to a specific OneDrive for Business folder
- The Muhimbi service converts that file to PDF.
For the final step, you’ll add an action that will move the PDF document to a SharePoint Online folder where the team can access it.
Select New step, and then select Add an action. Search for SharePoint, and select the SharePoint – Create file action.
In the Create file action, set the following values:
- Site address: The URL of your SharePoint site.
- Folder path: Select the folder icon and navigate to the PDF - Finished files folder.
- File name: From the dynamic content list for Convert document, select Base file name, then add “.pdf” so it will be saved in SharePoint with the file extension.
- File content: From the dynamic content list for Convert document, select Processed file content.
Select Create flow at the top of the page to save your work.
Test the flow
To test the flow, add a new file to your Finished Documents folder in OneDrive for Business.
In Flow, select My flows, and then select the new flow to view the run history. By default, the flow is configured to run every five minutes.
After the flow runs, verify that the file was converted to PDF and saved to the SharePoint PDF – Finished files folder.
You've completed the Build flows section of Microsoft Flow Guided Learning.