Power Automate Item Function vs Items Function

Power Automate Item Function vs Items Function

The Power Automate items functions returns the current item in an apply to each loop or a do until loop. Whereas the item function refers to the current item in a repeating action such as the Filter Array action or the Select Action. The examples in this article will help to illustrate how they are used.

Table of Contents
• How Does The Power Automate Item Function Work?Item Function Example #1: Filter An ArrayItem Function Example #2: Select Columns From An ArrayHow Does The Power Automate Items Function Work?Items Function Example# 1: Apply To Each Loop




How Does The Power Automate Item Function Work?

The Power Automate item function is useful in Data Operations actions such as the Filter action, the Select action, and the Join action. These actions iterate over an array and the item function allows us reference the current item.

item()



A property name can be included after the item function to target a specific column in the array.

item()?['columnName']




Item Function Example #1: Filter An Array

The SharePoint list named Paid Time Off is used to track paid time off requests for a company. It has the following columns and data types:

  • TimeOffDate – Date Only
  • RequestType – Choices [Personal, Vacation, Bereavemetn, Sick]
  • Status – Single-line text
  • EmployeePerson – Person



A Power Automate flow uses the Get Items action to obtain the Paid Time Off list items. The Filter action afterwards evaluates the SharePoint list items and returns only the items where Status equals Submitted.



An expression with the Power Automate item function is used on the left side of the comparison to target the Status column.

item()?['Status']



The array returned by the Filter action is this:

TimeOffDateRequestTypeStatus EmployeePerson
9/1/2020PersonalSubmittedKelly Smith
9/12/2020PersonalSubmittedSarah Green




Item Function Example #2: Select Columns From An Array

Another example using the same SharePoint list and the Select action evaulates the list items and returns only 2 columns of data.




The Date field is mapped to the TimeOffDate column using the Power Automate item function.

item()?[TimeOffDate']



And the Type (choices) field is mapped to the RequestType column using the item function.

item()?[RequestType']?['Value']



The output of the Select action is this array:

DateType
9/1/2020Personal
9/4/2020Vacation
9/5/2020Bereavement
9/8/2020Sick
9/12/2020Personal
9/13/2020Vacation
9/15/2020Personal
9/18/2020Personal





How Does The Power Automate Items Function Work?

The Power Automate items function can only be used inside of an Apply to Each loop. It is used to reference the current item in the loop.

items('Apply_To_Each_Action_Name')



A property name can be included after the items function to target a specific column in the current item.

items('Apply_To_Each_Action_Name')?['columnName']




Items Function Example# 1: Apply To Each Loop

The SharePoint list Past Due Invoices is used to track unpaid invoices. Every day the invoices are not paid an additional late-fee of $10 is added to the amount.



A Power Automate flow uses the Get Items action to collect all of the unpaid invoices. Then an Apply To Each loop iterates over each invoice and an Update Item action increases the Amount by $10.



The ID of the Past Due Invoices list item to update is obtained by this expression.

items('Apply_to_each:_Past_Due_Invoice')?['ID']



And the amount due is increased by writing this expression including the Power Automate items action.

add(items('Apply_to_each:_Past_Due_Invoice')?['Amount'],10)



The resulting SharePoint list items with updated amounts look like this once the flow is run:

Invoice DateCustomerAmount
7/1/2024ABC Company10010
7/9/2024DEF Limited5010
7/24/2024GHI Corporation8010
8/7/2024JLK Industries3010
8/14/2024MNO Partners1010





Questions?

If you have any questions or feedback about Power Automate Item Function vs Items Function please leave a message in the comments section below. You can post using your email address and are not required to create an account to join the discussion.

Matthew Devaney

Subscribe
Notify of
guest

2 Comments
Oldest
Newest
Inline Feedbacks
View all comments
Rob
Rob
19 hours ago

Thank you for another great tutorial! I never understood the difference, I just go with the flow (no pun!). But on a serious question… why is it that often times I cannot directly select the column from the dynamic menu and I have to manually create the item or items function? Why can’t power automate be smarter to know what I am trying to do?