Power Automate (WDL) function
first / last — Power Automate (WDL) function reference
First or last array element.
Syntax
wdl
first(collection) / last(collection)
Examples
wdl
first(body('Get_items')?['value'])→ One item
wdl
first(body('Get_items')?['value'])?['Title']→ The Title of the first returned row
wdl
last(split(item()?['Path'], '/'))
→ The final path segment (e.g. a file name)
Common mistakes & gotchas
- Calling first() or last() on an empty array throws "the provided array ... is empty" at runtime — guard with empty() or an if() first rather than assuming null.
- Both also work on strings: first('Hello') returns 'H', last('Hello') returns 'o'.
Related Workflow Definition Language functions
From Arrays & collections