Unwanted Apply to Each

When you add dynamic content to actions you will get those unwanted apply to each actions added by Power Automate.

Wanted Apply to Each

How do you avoid these unwanted apply to each actions?

Before anything else I’m first going to have a look at the apply to each steps that are added. They are definitely not all unwanted!

Just imagine that you collect a number of files from a document library in SharePoint and then you want to process them.

Avoid unwanted apply to each steps in Power Automate Microsoft Power Automate, Microsoft SharePoint Get files followed by empty compose

So you’ve got you get files action and then you add a compose action or any other set of actions that you might want.

Then you decide to use some dynamic content from the Get files action and the Apply to each step is added by Power Automate.

Wanted Apply to Each

So far so good and there isn’t really a problem with this Apply to each action at all. Power Automate was actually being very helpful!

Unwanted Apply to Each

Now, I will look at the unwanted Apply to each in Power Automate.

In my case I’m going to query a list in SharePoint that has a multi select field called Favourite Ice Cream using the Get item action. Another common field type that will show this same issue is with multi select people fields.

As I add dynamic content to my compose I will get an Apply to each step added again, but actually all I wanted is get the property Favourite Ice Cream out of my list item.

Unwanted Apply to Each

I don’t want this Apply to each step in this case. In one of my posts earlier this week about comparing content in Lists and Libraries, I would bump into the same issue with the select actions if I was to compare the documents based on a multi select field.

Another use case for example is when you have multiple people in an assigned to field and you want to send out a single email to multiple people.

You wouldn’t want an Apply to each that makes you send out separate emails to everybody. Assuming that you want to send out a single email to all people mentioned in a people field..

Avoiding the unwanted Apply to Each

So now the big question to answer, how do we avoid those unwanted Apply to each steps?

We will first need to look at the code behind the Apply to each and the Compose action inside the Apply to each.

The Apply to each takes the Favourite ice cream field. This array of values will then be processed inside the apply to each


Now looking at the compose action we will see the items function getting the value of each individual item.


Putting these two expressions together we will get the following expression


If you need an explanation about this querying json then please have a look at my query json post.

When the above expression is used, the apply to each will not appear and I can do whatever I like with the data.

Quite often I’m running into these issues with the select action or send an email action, but really these Apply to each actions could appear with any action.

Avoid unwanted apply to each steps in Power Automate Microsoft Power Automate, Microsoft SharePoint Avoiding the unwanted apply to each action

Note that you cannot use dynamic content to get this expression into your actions, you will have to either type the expression in the expression editor or like I did create an unwanted apply to each step first and then copy the expressions created into an editor and merge the bits that you need.

Personally I use notepad as it is plain and simple but any editor will do.

Further posts about apply to each steps



Avatar for Pieter Veenstra

By Pieter Veenstra

Business Applications Microsoft MVP working as a Principal Architect at HybrIT Services Ltd. You can contact me using contact@sharepains.com

14 thoughts on “Avoid unwanted apply to each steps in Power Automate”
  1. This is great, I can use it for choices but can’t seem to do the same for Person fields. Any advice on this.

      1. Hi, I have the same issue. It’s not working for Multi person field. Any advice please!

  2. Hi Pieter: I am trying to do this for an approval. I am putting the expression as follows into a variable, also trying a compose action: outputs(‘Start_and_wait_for_PD_approval_1’)?[‘body/responses/approverResponse’]

    However, it returns a blank. The name of the Approval is definitely correct. Any guidance?

    1. Hi Gregory,

      The problem will be in the expression:

      the following part of that will give an array of responses. Therefore you can’t directly select for a property inside.

      The following will probably give the first response:

  3. In your example you used “get files” from sharepoint, but i would like to know if it is possible to use with “filter array”.
    If yes, do you have an example to help me?


  4. My objective is to “list rows presents an excel table”, use the “filter array” and from that select only one column; would it be possible?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from SharePains by Microsoft MVP Pieter Veenstra

Subscribe now to keep reading and get access to the full archive.

Continue Reading

%d bloggers like this: