Shape Power Automate Flows Based On Forms Responses

We mentioned that it is possible to securely collect data in electronic environment with MS Forms. The automatic workflows are done with Power Automate flows.

In this article, we will create a flow that will be shaped based on the choices of the user by adding the Choose Action question.

If the user chooses Send Form to Approval, the Approval process is going to start. In the other case, only an info e-mail will be send.

After you add the Choose Action question to the Form, you can start the actions with a blank flow by switching to Power Automate.

Power Automate

While creating all flows, a trigger is created in the first step. Trigger is a required step for the flow to start working and it is important to specify it correctly. The flow we will create in this article will work when the Form is responded. So, the flow will be triggered every time the form is responded and will start to work. Add the When a new response is submitted trigger.  It is specified from the list of which poll is going to cause the flow to start when responded.

In the next step, we will look at the responses of the poll. Add the Get Response Details step to access the responses.

Choose the name of the poll in the Form Identity field. Choose Response Notifications List Response Identity for the Response Identity.

This step enabled us to access all question fields. This way, we can get the response of the Choose Action question.

In the new step, add Condition to test the response. Add the Choose Action question to the left with dynamic content.

And on the right, one of the responses will be written. Since we will be controlling a String, we will be using the String function.

It will be checked if the response given with the String(‘Send Form to Approval’) expression is equal to this value.

Add Approval to the Yes field of the Condition and Send an E-mail to the No field, and complete the process.

The approval mails can be sent to the person who has created the request (to the person who sent the form to approval) based on Approved/Denied condition.

Click here to read the other Power Automate articles.

Send Mass E-mails with Power Automate

You can send the mails with custom subject and content in which you address people specially in cases like congratulating, events, special day celebrations. This is something that especially the HR needs.

This way, you don’t deal with sending mails one by one. You only need to indicate the mail list and details.

Create a Table

Open en Excel in OneDrive. Add a Table from the Insert tab.

Write Mail, Name Surname and mail details into the columns of this table like below.

Each row of this table will be sent as separate e-mails by the flow.

Flow Process with Power Automate

Start a new blank flow.

After the data in the table is filled, flow will be run by being triggered individually. For this reason, start the flow with Manually trigger a flow.

In the next step, add Excel for Business (List rows present in a table) to be able to add the data in the Excel table. Add the table you’ve just created into this item.

In the next step, add Outlook (Send an e-mail).

In this step, the columns of the Excel table is added to the related fields. With you choosing the Excel fields (mail, name, etc.) the Apply to each item will be added to the flow automatically. An event will be created for each row in the Excel file thanks to the Apply to each item.

 

After filling the related fields, name the flow on top left corner. For example: Send Mails to a Certain List. You can save and close the flow on top right corner.

You can verify the data in the Excel table and run the flow.

You can take a look at here for the Power Automate Outlook Connector.

Send Calendar to a Guest List with Power Automate

You can send meeting calendars with customized data like addressing each person, event content and location for all your event invitations through Power Automate.

This way, you don’t have to deal with creating calendars one by one. You only need to indicate the guest list and event details.

Create a Table

Open en Excel in OneDrive. Add a Table from the Insert tab.

Write Mail, Name Surname and mail details into the columns of this table like below.

For each row of this table, e-mails will be sent separately by the flow.

The event date and hour was written as 2020-03-23T13:00:00 in order for it to be in the format Power Automate expects. The time format is 24-hours and the event will be created for the exact hour you determine.

Flow Process with Power Automate

Start a new blank flow.

After the data in the table is filled, flow will be run by being triggered individually. For this reason, start the flow with Manually trigger a flow.

In the next step, add Excel for Business (List rows present in a table) to be able to add the data in the Excel table. Add the table you’ve just created into this item.

In the next step, add Outlook (Send an e-mail).

In this step, the columns of the Excel table is added to the related fields. With you choosing the Excel fields (mail, name, etc.) the Apply to each item will be added to the flow automatically. An event will be created for each row in the Excel file thanks to the Apply to each item.

 

After filling the related fields, name the flow on top left corner. For example: Send Mails to a Certain List. You can save and close the flow on top right corner.

You can verify the data in the Excel table and run the flow.

 

You can take a look at this link for the Power Automate Outlook Connector.

Tag Channels and People in Teams with Power Automate

That mysterious topic everybody curiously searches in google and gets lost between tabs! We will look at how to automatically share posts with tagging channels and people in Microsoft Teams with Power Automate.

This is how our main question was born:

“HR departments shouldn’t spend half of their work day looking for who’s birthday it is and sending them e-mails, we use Teams as a communication platform within our company. Let’s create a system that can automatically create a birthday post. It can notify everyone and celebrate that person’s birthday.”

Power Automate is the name of Microsoft’s product that was known as Flow before. For this reason, when you are searching “power automate”, you can see the name of “Flow” in most of the websites you visit. Power automate is a workflow product that can work integrated with 200-250 products and you can transfer, write, read and create between these products. You can send your unfinished tasks to yourself every morning at 9 am and create flows integrated with a lot of products like creating tasks depending on the results of the poll you’ve sent.

Now, if we go back to our main problem, here is what we need to do:

  • We will create a data source that contains birthdays and e-mail addresses.
  • We will check the data to see if the birthday is today or not.
  • For those who have their birthdays today, we will choose a channel on Microsoft Teams, mention the person and channel; and thus, notify everyone.
  • We need the system to repeat this everyday.

Let’s move step by step. First, go to Power Automate’s website and create a new flow.

1-CHOOSING THE TRIGGER

A trigger is what you need the most to start a flow. The question should be: “When do I want this flow to start running?” We will use “Recurrence” in this flow. After we choose the trigger, we enter information concerning when it will start running. We chose 10 am every morning for this flow.

power automate ile teams de mention için yineleme triggeri gif

2- Connection to the data source that contains birthdays and personal information

We will use SQL as data source here. If you want, you can you Excel. I need to mention something very important before we start; when you want to change the data source, you have to create the flow from the beginning. Because we will control and make actions using this source. The action we choose is the “Get rows” action. This way, it will be able to check for all in the table.

sql bağlantısı

3- The “Is their birthday today?” control

For this control, we choose condition. In this condition there will be two pieces: the first one will check the birthday piece (is it the same day of the month?), the second one will check the month (is it the same month?). Now we will write an expression into the “Choose a value” section.

power automate kosul ekleme

I left an image below so that it is not hard for you to follow conditions. You can find the code version of one below as well. We use the formatDateTime function to get the day parts of date expressions on the first row. And we use the utcNow function to see if they match up with today or not. The ‘dd’ and ‘MM’ expressions next to them represent date and month respectively. When you add these expressions it will include it to the “Apply to each” step. The items(‘Apply_to_each’) step in the formulas comes from here. [‘Birthday’] is the name of the row in which the birthdays are stored in our data source.

PS: We have to use the ‘MM’ expression in capital like this or it doesn’t get detected, we didn’t type it incorrectly.

kosullar

formatDateTime(items('Apply_to_each')?['Birthday'],'dd')

4- TAGGING IN TEAMS

And now let’s come to the main topic! After we do the steps below, the important thing is to share the post of the birthday. In this step, first, we need to choose in which group and channel the post will be shared and get the id of the group&channel. After choosing the said group and channel, you can get their ID fields with Power Automate. There are two actions for that: Get Groups, Get Teams Channels. You can find the IDs on their outputs by running these requests.

power automate list channel

Write the ids you got into its place in this address:

https://graph.microsoft.com/beta/teams/TEAM_ID/channels/CHANNEL_ID/messages

We will send a request to graph.microsoft.com  in order to use this feature about Teams. Microsoft Graph is a developer platform that connects multiple devices and services to each other.

The action we will use to tag and mention in Teams with Power Automate: HTTP with Azure AD – Invoke an HTTP Request

 

power automate invoke http request

If you have never used this action before, you will not come across a screen like the one below; first you will come across a screen where you need to login. You need to copy graph.microsoft.com into two fields in the screen.

base eresource

After this step, you need to fill in all 4 fields in the screen.

  • First we choose the POST option for the method field since we will be publishing a message.
  • Next, we will write the link we’ve created above that starts with graph and continues with teams_id and channel_id for the Url of Request field.
  • We write Content-Type into the Enter Key field and application/json into the Enter Value field for the Header section.
  • We paste the code block below into the Body of Request field.
{
"body": {
"content": "General Happy Birthday @{items('Apply_to_each_2')?['DisplayName']}
",
"contentType": "html"
},
"mentions": [
{
"id": 0,
"mentionText": "General",
"mentioned": {
"conversation": {
"id":"19:[email protected]",
"displayName": "Business Applications Trials",
"[email protected]": "#Microsoft.Teams.GraphSvc.conversationIdentityType",
"conversationIdentityType": "channel"
}
}
},
{
"id": 1,
"mentionText": "@{items('Apply_to_each_2')?['DisplayName']}",
"mentioned": {
"application": null,
"device": null,
"conversation": null,
"user": {
"id": "@{items('Apply_to_each_2')?['Id']}",
"displayName": "@{items('Apply_to_each')?['DisplayName']}",
"userIdentityType": "aadUser"
}
}
}
]
}

 

It will look like this after all these steps:

 

http isteği dolu hali

BODY EXPLANATION

Let’s explain the body section a bit. We enter an HTML content we want to the content. You can add images etc. to that content. Inside in the HTML content, we tag the people we want to tag. We you IDs while doing that. We define the ids inside these tags into the mentioned field at the bottom of the code block. We will both tag the channel -which is tagging the group-, and the person. You can give the ID numbers, it doesn’t matter which number you give. The important thing is that it matches with the mentioned field below.

In the mentioned field, we will determine in which chat this post will appear, i.e. we will tag the channel first. And for us, this is the general channel of our Business Applications Trial group. We write our channels id into the id field in conversation. And enter the “Channel” info into ConversationIdentityType. Another thing is to tag the person. We need that person’s Office 365 id while writing their tag. We can get this id through Power Automate. The action we need to use at this point is Office 365 Users- Search User. We get the user’s id by using their e-mail address.

search user

 

We write this id into the related id field. Since we will tag the person, userIdentityType comes instead of ConversationIdentityType. We write “addUser” here aannndd save.

 

That’s it! We are done. The last thing I want to mention is that you can get more detailed information about Teams APIs on Graph from the links below. We also have some other great articles about Power Automate and Teams on our blog, you can check them as well. And also here is the output of this flow.

power automate ile teams de mention

https://docs.microsoft.com/en-us/graph/api/channel-post-messages?view=graph-rest-beta&tabs=http

https://docs.microsoft.com/en-us/graph/api/resources/chatmessage?view=graph-rest-beta

https://docs.microsoft.com/en-us/graph/api/resources/chatmessagemention?view=graph-rest-beta

https://docs.microsoft.com/en-us/graph/api/channel-post-messages?view=graph-rest-beta&tabs=http

See you guys, social isolation is important