Item vs Items

Today a short post, about the item function and the items function in Apply to each step.

Apply to each in Power Automate

When you create apply to each step you can use the Current item to refer to the item that is being processed within the apply to each step as shown below.

Item vs items in Apply to each steps in Power Automate Microsoft Office 365 image 41

Power Automate makes it easy to just select Current item from the Dynamic content and all is good! Until you looking under the hood of the Current item. We will see that the following expression is used when we select Current item:

items('Apply_to_each')

Nothing complicated.

Copy/Paste actions

But how about copying the action inside the Apply to each to another apply to each as we want to replicate this step. So we use the copy paste functionality in Power Automate and we might create a flow like this.

Item vs items in Apply to each steps in Power Automate Microsoft Office 365 image 42

Now when we hit the save button, we will see the following error message


The template validation failed: 'The inputs of template action 'Compose_4' at line '1 and column '1575' is invalid. Action 'Apply_to_each' must be a parent 'foreach' scope of action 'Compose_4' to be referenced by 'repeatItems' or 'items' functions.'.


The template validation failed: ‘The inputs of template action ‘Compose_4’ at line ‘1 and column ‘1575’ is invalid. Action ‘Apply_to_each’ must be a parent ‘foreach’ scope of action ‘Compose_4’ to be referenced by ‘repeatItems’ or ‘items’ functions.’.

Well that is annoying, You will have to remove the current item on the right and then reselect the current item from the Dynamic content.

Item to the rescue!

Rather than using items(…), we can also use the item function

Item vs items in Apply to each steps in Power Automate Microsoft Office 365 image 44

Now as the expression isn’t depending on the Apply to each step anymore we can simply copy the step from one Apply to each to another apply to each and the flow will just save.

So the next time you select the Current item form Dynamic content you might want to consider using the expression editor and type item() instead.

Item vs items in Apply to each steps in Power Automate Microsoft Office 365 image 45

As we have seen with copy/paste, where the items function causes some problems. If you drag and drop actions from one place to the other will give similar issues that we will not see if we use the item function instead.

By Pieter Veenstra

Business Applications and Office Apps & Services Microsoft MVP working as a Microsoft Productivity Principal Consultant at HybrIT Services. You can contact me using contact@veenstra.me.uk.

Leave a Reply

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

%d bloggers like this: