Item() and Items(Apply to each) Functions Explained with Examples

Updated: 07 December 2022


In this post, I aim to provide a clear explanation of the item() and items() functions in Power Automate. By the end of this post, you will have a deeper understanding of these functions and be able to utilise them effectively in your workflows.

  1. Example 1: item() and items() can refer to the same element in an array
  2. Example 2: item() gives you the context
  3. Example 3: Filter Array action – item() gives you the context
  4. Example 4: items() function SHOWS the context
  5. item() function must not have any parameters
  6. Use the following syntax example for the item() function
  7. Further reading
item() gives you the context, and, items() shows you the context

Example 1: item() and items() can refer to the same element in an array

The item() and items() function is used to get the value of the current item as shown below.

The following example initialises an array of fruit names:

An array of fruit

Then loop over (iterate) each of the items in the array using an Apply to each loop.

Compose actions are used to show the values of item() and items('Apply_to_each'):

Apply to each using item and items

Note how the expressions item() and items('Apply_to_each') refer to the same element in the array:

item() and items('Apply_to_each') refer to the same element in the array

Example 2: item() gives you the context

item() gives you the context

The following example initialises an array of fruit names and an array of department names:

two arrays initialised. An array of fruits and an array of departments

Note the two uses of the item() expression below:

  • The context of item() in the compose action is the varFruit variable of the Apply to Each loop. The Apply to Each loop loop iterate through each of the values of fruit: Apple, Mango, Pear, Grapes and finally Banana
  • The context of item() in the Filter Array action is the varDepartments variable. The Filter Array action will iterate through each of the values of in varDepartment: IT, HR, Facilities, Finance and finally Security and select a department that is equal to HR.
Note the two uses of the item() expression. The context of item() in the compose action is the varFruit variable. The context of item() in the Filter Array action is the varDepartments variable.

Example 3: Filter Array action – item() gives you the context

Note the two uses of the item() expression below:

  • The context of item() in the Filter Array action is the varFruit variable
  • The context of item() in the Filter Array 2 action is the varDepartments variable
The context of item() in the Filter Array action is the varFruit variable

The context of item() in the Filter Array 2 action is the varDepartments variable

Sample runtime output of the Filter Array actions:

sample runtime output of the filter array actions.

Example 4: items() function SHOWS the context

items() shows you the context

In the example flow below note how the items() function shows the context:

  • the context of items('Apply_to_each') is the Apply to Each loop
  • the context of items('Apply_to_each_2') is the Apply to Each 2 loop
When using nested apply to each loops - items() function shows the context
When using nested apply to each loops - how do you reference an item in the other loops?
When using nested apply to each loops – how do you reference an item in the other loops? Reference the name of the loop.

When using nested apply to each loops – see the example above on how to reference an item in the outer loops.

item() gives you the context, and, items() shows you the context

item() function must not have any parameters

item() function must not have any parameters

Use the following syntax example for the item() function

Use the following syntax example for the item() function

Further reading

One thought on “Item() and Items(Apply to each) Functions Explained with Examples

Add yours

  1. This is exactly what I was looking for and the format you used to show the context is easy to read. Thanks for taking the time to put this together!

    I think people may also be searching for something like “How to find the current index of an apply to each loop” or “Index of parent apply to each loop”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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

Website Built with WordPress.com.

Up ↑

%d bloggers like this: