Cheat Sheets/Power Automate/first / last
Power Automate (WDL) function

first / lastPower 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

Related Workflow Definition Language functions

From Arrays & collections

Used in these tutorials

← Back to the Power Automate (WDL) cheat sheet