How to Use the items() Function in Power Automate
Inside an Apply to each loop, items() gives you the item the loop is working on right now. Add ?['name'] and you get one of its properties. It's the expression you'll write most inside loops, and nested loops are where its loop name matters.
What It Does
Microsoft's functions reference defines items() as the current item from each cycle of a for-each loop, used inside that loop. You name the loop:
items('<loopName>')
The loop's name is the one you gave it, with underscores for spaces: a loop called For each list is For_each_list.
Prerequisites
- A loop over an array. See How to Loop Through an Array with Apply to Each. The example is For each list in the setup flow from Part 11 of the Career Development Plan series. Each item is one list's definition:
{
"title": "RoleCompetencies",
"description": "Competencies and expected levels for each job title. Used by the Career Development Plan app.",
"noCrawl": false
}
Each item also has a columns array, used further down.
Read a Property
To get the current list's title, add the property name after the item:
items('For_each_list')?['title']
['title'] reads the title property. The ? before it makes the read safe: if the item were empty, you'd get nothing instead of a failed step.
Add it with the expression editor (How to Add an Expression in Power Automate), here in the middle of Find the list's Uri:
![The expression editor containing items('For_each_list')?['title'], beside the Find the list pane whose Uri ends in _api/web/lists?$filter=Title eq '](https://strdewiridedevblogsprod.blob.core.windows.net/images/blog/power-platform/power-automate/2026/pa-items-01-expression-editor.webp)
In Code view, an expression inside text sits in @{...}:
_api/web/lists?$filter=Title eq '@{items('For_each_list')?['title']}'&$select=Id
In the first pass, that's _api/web/lists?$filter=Title eq 'RoleCompetencies'&$select=Id, and in the second, the same with CompetencyResponses.
Nested Loops
Each list has a columns array, and a second loop, For each column, goes through it. Inside the inner loop, both items are available:
| Expression | Returns |
|---|---|
items('For_each_column')?['name'] | The current column's name |
items('For_each_column')?['schemaXml'] | The current column's XML definition |
items('For_each_list')?['title'] | The title of the list the columns belong to |
That's why items() takes the loop's name. Microsoft's reference also has item(), with no name, which returns the current item of the loop it's in. With nested loops, naming the loop leaves no doubt.
Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
| Spaces in the loop name | The expression doesn't find the loop | Use underscores: For_each_list |
| Renaming the loop afterwards | Expressions keep the old name | Name the loop before writing expressions |
| A property name that isn't in the data | You get nothing back | Copy the name exactly from your data |
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| The expression returns nothing | The property name differs from the data | Check the item in the loop's run results |
| An error about the loop name | The expression is outside that loop | Use items() only inside its loop |
FAQ
What's the difference between items() and item()?
items('Loop_name') reads the current item of the loop you name. item() reads the current item of the loop it's in. In a nested loop, items() lets you reach the outer loop's item too.
Can I use it in a condition?
Yes, anywhere inside the loop: in a field, in a body, or in a condition's values.
Conclusion
Inside a loop, items('Loop_name') is the current item, and ?['property'] reads one of its values safely. Use the loop's name with underscores, and in nested loops pick the loop whose item you mean.
Additional Resources
- Reference guide to functions in expressions:
items()anditem().
