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 Array
• Item Function Example #2: Select Columns From An Array
• How 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:
TimeOffDate | RequestType | Status | EmployeePerson |
9/1/2020 | Personal | Submitted | Kelly Smith |
9/12/2020 | Personal | Submitted | Sarah 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:
Date | Type |
9/1/2020 | Personal |
9/4/2020 | Vacation |
9/5/2020 | Bereavement |
9/8/2020 | Sick |
9/12/2020 | Personal |
9/13/2020 | Vacation |
9/15/2020 | Personal |
9/18/2020 | Personal |
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 Date | Customer | Amount |
7/1/2024 | ABC Company | 10010 |
7/9/2024 | DEF Limited | 5010 |
7/24/2024 | GHI Corporation | 8010 |
8/7/2024 | JLK Industries | 3010 |
8/14/2024 | MNO Partners | 1010 |
Did You Enjoy This Article? 😺
Subscribe to get new Power Apps & Power Automate articles sent to your inbox each week for FREE
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.
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?
Rob,
“Why can’t power automate be smarter to know what I am trying to do?” That is a great question. The answer is sometimes Power Automate cannot predict the JSON response structure. So it makes us use a Parse JSON action to define the schema ourselves. That being said, in this day and age of fancy-AI announcements every 6 hours I feel there is something that could be done about your suggestion. Thanks for writing me!