How to periodically use the "apply to each" action in Power Automate

How to periodically use the "apply to each" action in Power Automate In this walkthrough you'll learn to use the 'apply to each' inside of Power Automate Flows. The idea of apply to each is it gives you the ability to loop through a table of data. And then do the same action repetitively for each one..

Let's build a quick example. To start we'll navigate from the home page of flow to the create and then we'll choose an instant cloud flow. We will manually trigger that flow and we'll give it a name like apply to each test..

Now we'll click on create. this manually triggering flow allows us to quickly trigger the flow without having to do some other type of activity and is great for learning and testing purposes. So now we'll use a new step and we'll use the approval action.

And we'll start and wait for an approval. For the approval type we'll set it to be everyone must approve and now it gives us a chance to set a title. And so for the title we'll say our test approval.

And then for the assigned to we're going to assign it to multiple people. So we're going to assign it to Alex and then to Paddy. Just like so now we have both of them available and so now when we go and start and wait for our approval we want to send a notification on whether or not they've approved it..

So we'll add another new step and then we'll search for notification and we'll say Send an email notification. This will send an email to you the creator of the flow with the output and so for the subject we'll say approval status. And then for the body down here we want to do a couple things..

How to periodically use the

First we want to do a) what is the outcome? So the outcome was and then we'll use dynamic content and we can go over here and we'll search for outcome. And we'll see the outcome of the approval..

So that way we can send the outcome do they approve or reject? Then now we're going to put our cursor right here and we're going to say enter again. And we're also going to say the comments were And so with the comments.

Each one of the two approvers so in our case Alex and Patty will be able to provide a comment. So we'll put the cursor right here we'll go to dynamic content and then we'll remove the outcome we search for earlier and we'll search for comment..

And you see responses comments, comments added by the approver. In our case we have multiple approvers so when we add this this is going to be a table of data we're going to have a response from Alex and response from patty. When we add this.

You're going to see that an apply to each loop automatically gets wrapped around send email notification. So let's click on it to see that happen. So there you go, it automatically did this. Now what will happen and apply to each loop now is that for.

Each response from the tables of responses. In this case there'll be two right, one from Alex one from Patty. For each response it's going to do everything inside of this block. And so in that case it's going to send me an email notification and it's going to send me an email notification once for Patty.

Posts Related:

    And once for Alex.

    So let's test this out and see what happens. So we'll go up here we'll say 'Save'. And then we'll go to test. And we're going to manually trigger the test manual and then test..

    And this is just confirming we have connections we do so we'll say continue and then run the flow. Done, okay so now Alex and Patty are getting notifications so I'll go ask them to approve our item..

    I'll be right back. And just like that they've both approved it and so now you can go down and click on the apply to each step and you're going to see that it is running one of two and then we can go to next two of two and so this is going to run these steps for each of the activities to be done it's completed you may have heard me.

    Just get the ding of a couple of emails. And so here you can see the outcome was approved and the comments were looks good from Alex so when Alex approved this email got sent. And then if we go over here to the number two.

    Then we're going to see that I approve this test and Patty So I actually got over here my email box two emails one for each one because apply to each runs once for each item in your table each result. And so since we had two of those we got two messages..

    Now if we click on edit again so when you're creating your flows you have the ability to use this to loop through. Maybe you're getting a bunch of items out of Dataverse or SharePoint and you want to loop through those or loop through all your Emails or some other type of activity.

    Where you're going to get back a table of data and you want to do a step each one apply to each is going to do that. Flow also does a great job of automatically understanding when you go to add dynamic content. That you wanted to do and apply to each.

    Because you chose a table of data as a source. So it'll often add it for you but it is possible to go down here to new step and you can search for apply to each and then you could add it and there you go now you are.

    DISCLAIMER: In this description contains affiliate links, which means that if you click on one of the product links, I'll receive a small commission. This helps support the channel and allows us to continuetomake videos like this. All Content Responsibility lies with the Channel Producer. For Download, see The Author's channel. The content of this Post was transcribed from the Channel: https://www.youtube.com/watch?v=DVqUkPOUt60
Previous Post Next Post