Hazard Reporting Tutorial Series (Part 2): Microsoft Flow - Approvals, Teams Channel Creation, Notification

Introduction - Hazard Reporting Solution

Welcome to our Hazard Reporting Solution blog series. This is Part Two of the series, where we show you how to create a Flow for approval of a reported hazard.

In the first part of the hazard reporting series, we covered how to capture a hazard.

It included the process of building a SharePoint List for storing data, and we also showed the process of building an app with PowerApps.

The app built was a mobile app that captures the details of a hazard and includes the ability to add an attachment, if you’re using the mobile app with your smartphone. 

All the data captured with that PowerApps goes back in the SharePoint list created earlier. 

In this second part of the blog series, we walk you through extending the Hazard Reporting Solution created earlier, to classify hazards as emergencies or not. 

We will cover the following points, step by step, in this article:

1. Test the PowerApp Built in Part 1

2. Setup the solution in MS Teams and SharePoint

2.A. Create a Team

2.B. Update SharePoint

3. Create a Flow to Evaluate the Reported Hazard

3.A. Create a Flow and its Trigger

3.B. Set up an Approval Action for the Hazards

3.C. Add Conditions to Evaluate the Approval

3.D. Create a Channel in MS Teams

3.E. Post a Message in the Teams Channel

3.F. Send an Email to the Team

3.G. Update the SharePoint Item

4. Test the Flow

4.A. Create a Hazard and Check Its Status

4.B. Approve the Hazard as an Emergency

4.C. Check the Flow, Including Channel Creation

4.D. Check Hazard Status’ Notifications

Rather Watch a Video?

Watch the video or read the step-by-step instructions below:

Let's get started with continuing the build of our Hazard Reporting Solution

1. Test the PowerApp and SharePoint List from Part 1

We will begin where we left off in the last blog. We will test the App we created earlier.

Step 1: 

  • Open the Hazard Reporting PowerApps (built in Part 1), on your mobile phone.

  • The form in the PowerApps is smart, so it displays the currently logged-in user and Today’s date.

  • Type in the Description of the hazard you want to report.

  • Attach a picture of the hazard.

  • Save the Hazard Report

Screen Shot 2019-08-31 at 8.04.04 PM.png

Step 2:

  • On saving the report in PowerApps, the app writes the data back to SharePoint.

  • Go to the Hazard Report SharePoint list.

  • There, you will see the capture of the new hazard report in the list of hazards.

Screen Shot 2019-08-31 at 8.04.14 PM.png

2. Solution Setup: Create a Team and Update the SharePoint List

To set up this module for hazard reporting, we need to create a team in Microsoft Teams.

2.A. Create a Team

Step 1:

  • To create a team, go to Microsoft Teams. This team will be used for tracking the emergencies within.

  • In our case, you can see in the screenshot that we have a Hazards - Emergency team created.

  • Note: This solution will add a new Channel into the Team for each hazard that’s identified as an emergency through the mobile app. We’re going to do all this using a Microsoft Flow automation.


2.B. Add New Columns to the SharePoint List

Step 1:

  • Go to SharePoint.

  • Browse to the SharePoint list created in Part 1.

  • Add a Yes/No column—Click on Add column.

    • Select Yes/No option in the drop down.

    • In the right hand pane that appears, Name the column Emergency.

    • Set its Default value to No.

  • Click on Save.


Step 2:

  • Add a Choice column by clicking on Add column and then on Choice option.

    • Name the new column Choice column Status.

    • Set the Choices to:

Under investigation


  • Set the Default value to Under Investigation, and Save the column.

  • Now, our list is ready to go!


3. Create a Flow to Evaluate the Reported Hazard

The next thing we need to do is access the Flow portal. 

3.A. Create a Flow and its Trigger

Step 1:

  • Go to flow.microsoft.com (flow.microsoft.com).

  • In the left navigation of the screen, Click on + Create.

  • Click on Automated flow, to create a new automated flow.

  • Note: Microsoft has created a ton of Flow Templates for free! You can create a flow using the templates. We encourage you to look into them.

Screen Shot 2019-08-31 at 8.04.42 PM.png

Step 2:

  • Name the Flow Hazard Reporting - Evaluate.

  • Click on the ‘When an item is created in SharePoint’ trigger in the list of triggers.

  • Click on Create.

Screen Shot 2019-08-31 at 8.10.32 PM.png

Step 3:

Next we will be presented with the Flow designer.

  • The first item in every Flow is the trigger. At this point, the trigger needs to be setup

    • Specify the site the list lives on - In Site Address, choose the Incident Reporting Site.

    • Then choose the List Name. We chose Hazard Report, which is within that site. (That’s the SharePoint list where we just added our columns).

Screen Shot 2019-08-31 at 1.21.20 PM.png

3.B. Set up an Approval Action for the Hazards

Step 1:

  • Add an Approval Action

    • Click on + New Step, to add an action.

    • Under Choose an Action, search for ‘start and wait for approval’.

    • Note: After the trigger is set, i.e. once a new incident is identified, we are going to ‘Start and wait for an approval’. This is one of the approval actions.

    • Select the Approvals action ‘Start and wait for an approval’ from the list that shows up.

    • Set the Approval type to Approve/Reject - First to Respond pattern.

Step 2:

  • Under the Approval Action

    • Set the Title for this action to ‘Incident report - Is this an Emergency?

    • Note: We are going to take the first response we get from anyone who this Approval is assigned to.

Screen Shot 2019-08-31 at 1.38.43 PM.png

Step 3:

  • On the Approval Action

    • In Assigned to section, enter the email IDs of people who need to be responsible for the approval. (We chose Admin 1, Admin 2, and Admin 3.)

    • Note: These are the people that handle the emergency and evaluate hazards to determine whether they are emergencies. A few people will receive the approval, and the first one to respond will be the one that we will use to determine the state of the hazard.

Step 4:

  • On the Approval Action

    • Include appropriate text in the Details. In our case, it says:

“If you approve  this hazard, it’s going to go down the Emergency route in our process, and a few extra things will happen for it.

“The following item has be submitted. **_Approve_** this item if it should be routed for emergency handling.

Rejecting this item will send it down the **_Standard_** workflow for Incident Reporting.”

Step 5:

  • On the Approval Action

    • Next, include a link to the hazard’s details—go to Item link section of the action.

    • Search for link to item in Dynamic content in the pop-up box.

    • Click on Link to Item from the list that shows up.

    • Note: This is done so that if the people responsible are re-evaluating this and deciding wether or not it’s an approval, they can get all the details from the hazard’s data in SharePoint.

Step 6:

  • On the Approval Action

    • Go to Item Link Description, by again searching for the Description in the Dynamic content list in the pop-up.

    • Select Description.

    • Note: This will enable the person approving the hazard to be able to click on the details of the Hazard, in the approval email/message itself, and get those details.

3.C. Add Conditions to Evaluate the Approval

Step 1:

  • Click on + New Step.

  • The next step is to add a Condition.

  • Click on Condition, under Actions.

  • Note: Conditions are very useful in their ability to evaluate data in MS Flow - in our case, the Outcome of the approval.

  • Click inside the Choose a value box of the Condition.

  • From the pop-up, you can select Outcome under Dynamic Content.

Screen Shot 2019-08-31 at 1.43.36 PM.png

Step 2:

  • On the Condition

    • The condition now says that if the Outcome is ‘equal to’ ___________.

    • In Choose a value section, type Approve.

    • So, when the outcome is approved, we will move to the following action:

      • Click on Add an action under If Yes.

      • Note: Under this path, if something has been determined to be an emergency, we want our Flow automation to do a few extra things.

3.D. Create a Channel in Teams for the Emergency Items

Step 1:

  • Click on Add an Action

  • Type ‘channel’ in the search box under Choose an Action.

  • Click on Create a channel under Actions.

Screen Shot 2019-08-31 at 1.48.10 PM.png

Step 2:

  • On the Create a channel Action

    • Select the Team called Hazards - Emergency (or whatever you named your team).

    • In the Display Name field, type “Emergency Hazard”

      • Click to the right of the in “Emergency Hazard” text, from the Dynamic Content selector, search for ID, and from within SharePoint.

    • Select the ID of the item that was submitted from PowerApps.

    • Note: This will create consistent naming for each Channel.

Step 3:

  • On the Create a channel Action

    • Click on Show advanced options.

    • Provide a Description for the team—Use the Description of the actual issue by clicking in the Description box.

    • In the Dynamic Content selector, search for ‘Description’.

    • Select the Description of the issue in SharePoint.

    • Note: This will give some context to people looking at the different channels.

3.E. Post a Message for the Channel

Step 1:

  • Under the If yes part of the condition

    • Click Add an Action.

    • Here, we will post a message. We want people who come to the team to see information in the conversation right away.

    • Under Choose an action, search for post.

    • Choose the ‘post a message’ action under Microsoft Teams, from the action selector.

Screen Shot 2019-08-31 at 1.54.52 PM.png

Step 2:

  • On the Post a Message Action

    • For Team, choose the Hazards Emergency team (created earlier in this post).

    • For the Channel value, we will dynamically specify the channel we’re posting this to, based on the previous action where we created the channel.

      • Click on Enter Custom Value in the Channel placeholder.

      • Type ID in the Dynamic Content selector

    • Choose Id from the Create a channel action.

Step 3:

  • Set the Message value of the action

    • Click on the small ‘<>’ / HTML button in the Message editor.

    • Enter the following HTML into the message editor:

<p> This channel has been created as a collaboration area for incident <br>


Incident description: <br>

Latitude: <br>

Longitude: <br>


Here is the link to the original information: <a href=‘’>View the incident</a> </p>


Screen Shot 2019-08-31 at 2.01.59 PM.png

Step 4:

  • Add placeholders from the Dynamic Content selector into the message box - as shown in the above screenshot.

    • Click on the place where you would like to add dynamic content and make a selection.

3.F. Send an Email to the Team

Step 1:

Add the Outlook: Send an Email action.

  • Click on Add an action.

  • Type ‘send’ in the search box of Choose an action.

  • Click on Send and email from the list.

    • Note: We are adding this action to notify the stakeholders that this area has been created for managing this hazard.

Screen Shot 2019-08-31 at 2.10.25 PM.png

Step 2:

  • In the To section, add all that stakeholders.

  • Also include the creator:

    • Search for ‘Created by’ in the Dynamic content selector, and choose Created by DisplayName.

  • Add Subject of the email: New Emergency Hazard Identified.

Step 3:

  • In the Body, type:

“A Teams Channel has been created for collaboration on this issue <br> <br> 

Click here to access the Teams Channel:  “

  • In the above, we provide a link back to the that team we created.

Step 4:

  • Click on Show advanced options

  • As ours is an HTML message, select Yes for Is HTML option.

  • Now, put in a link in the email body: <a href=’’>Open the Channel in Teams</a>

Step 5:

  • To add the link, go back to Teams

    • Find the Team we created earlier select the General channel.

  • Click on the ellipsis icon next to General to get the link to the channel.

  • Copy the link of the General channel, and from this you can derive the link for the channel dynamically created in MS Flow.

Screen Shot 2019-08-31 at 2.10.40 PM.png

Step 6:

  • Go back to the email body in the flow, click between single quotes ‘’ in the a href.

  • Paste the link to the General channel there.

  • Then Remove part of the link you just pasted

    • Remove everything between the backslash after the word channel and the question mark before the word groupId, as shown in the below screenshot.

Action Updated.png

Step 7:

  • In the href between the / and ? (that was removed in the previous step), add the Id of the channel we created earlier.

    • Search for ID in the Dynamic content selector and select Id, under Create a channel.

  • The Body element of the Send an email action should appear as shown below.

Screen Shot 2019-08-31 at 2.16.57 PM.png

3.G. Update the SharePoint Item

Next we will update the original SharePoint list item.

Step 1:

  • Click Add an action

  • Type Update item under Choose an action.

  • Choose the Update Item (SharePoint) action

  • In the Site Address placeholder, choose the Incident Reporting Site address.

  • In the List Name placeholder, choose the Hazard Report list.

  • For Id, choose the ID of the item that triggered the flow

    • Choose ID from the Dynamic content selector.

Step 2:

  • Complete the other metadata as shown in the image below.

  • Note: We are matching what we previously have set in the list item, as we don't want to change anything.

  • Add Title to the Title placeholder, using the Dynamic content pop-up.

    • Similarly, add Date Submitted, Latitude, Longitude, and Description from the Dynamic content pop-up.

Screen Shot 2019-08-31 at 8.31.20 PM.png

Step 3:

  • In the Emergency placeholder, type Yes.

    • This is the main point of doing this activity.

  • For Status, mark Under Investigation.

  • Now that we’ve added our update item, we can Save this Flow.

4. Test the Flow

4.A. Create a Hazard and Check Its Status

Step 1:

Let’s go back and test our work.

  • Go back to PowerApps.

  • Specify a hazard that’s out there, for example ‘A trip hazard - At door 1 in building E’.

  • Attach an image

  • Save it.


Step 2:

  • Go to SharePoint

  • You will see an entry for ‘A trip hazard - At door 1 in building E’.

  • You will notice that the default value under the Emergency column is No.

  • Under the Status column, the default status is Under Investigation.

Screen Shot 2019-08-31 at 2.24.57 PM.png

4.B. Approve the Hazard as an Emergency

Step 1:

  • Go to Outlook/or the email inbox of one of the stakeholders.

  • You will see a new Flow approval with the subject ‘Incident Report - Is this an Emergency?’

  • The email tells that there is a pending approval.

  • Note: This approval went out to all the three people who you specified in that approval action. The email specifies that if you approve this action, it’s going to be routed for emergency handling. Otherwise, it will take the standard flow.

Screen Shot 2019-08-31 at 2.31.07 PM.png

Step 2:

  • You can click on the link in the email to the see the details and additional information about the Hazard in SharePoint.

  • In SharePoint, we can click on Attachments to look at the image of the hazard. (Screenshot below)

  • Once the approver is sure that it is in fact an emergency, they can mark it as such by clicking on Approve and then on Submit, in the email. (Screenshot above)

Screen Shot 2019-08-31 at 8.34.08 PM.png

4.C. Check the Flow, Including Channel Creation

Step 1:

  • Now, go back to our Flow.

  • We save all the previous work and we see what’s happening in the flow by going to the Flow’s landing page.

  • Click on My flows, and then on the latest update in the flow under Runs.

  • You will see a message ‘Your flow ran successfully.’

  • You will see that it evaluated the approval action, created a channel and posted a message. It even sent and email and it updated that item back in SharePoint.

Step 2:

  • Now, go to Microsoft Teams, where you will see an Emergency Hazard 18 created as a new channel in the team.

  • You will see a message posted in that channel.

  • Just like we planned, we can see the metadata that you merged in from SharePoint.

Screen Shot 2019-08-31 at 2.39.26 PM.png

Step 3: 

  • You can also click on the link View the Incident from within Teams.

  • It take you to SharePoint, where you will see all those details about that original item that was submitted from PowerApps.

4.D. Check Hazard Status’ Notifications

Step 1:

  • Let’s go back to Outlook mailbox.

  • You will see a new email—New Emergency Hazard Identified

  • Click on the link ‘Open the Channel in Teams’

  • It will jump you right into Teams.

  • Note: It’s useful for a stakeholder who perhaps wasn't the approver or the creator of that particular hazard. With this link, they’re brought back into the flow of this notification, and now they even know where that is.

Screen Shot 2019-08-31 at 2.39.15 PM.png

Step 2:

  • The last thing to do is to go back to the actual item in SharePoint and see that the Emergency columns is marked as Yes.

  • Refresh the SharePoint list.

  • You will notice that the the Emergency column value has changed to Yes and we know that at this point we have a hazard that’s been identified.

This completes the Flow enhancement functionality —the first of two.

We look forward to bringing you another Flow, that’s also a part of this Hazard Reporting solution.