This Flow Script tutorial explains how to use the FirstOrDefault function with syntax and examples.


The FirstOrDefault function returns the first record in the table. If the table is empty, defaultValue is returned instead.


‌The syntax for the FirstOrDefault function is:

FirstOrDefault(table, defaultValue)


table - the table with the data from which the first row is to be taken.

defaultValue - the record values returned if the table is empty.


‌The FirstOrDefault function returns a record.

Applies To

Flow 6‌.13


Let's look at some FirstOrDefault function examples and explore how to use the FirstOrDefault function.‌

FirstOrDefault(color, [Id:'C5', Color:'pink'])
Result: Id: C1, Color: red - as Record

FirstOrDefault(emptyTable, [Id:'C5', Color:'pink'])
Result: Id: C5, Color: pink - as Record

FirstOrDefault( table(a, b), [a: 0, b: 0])
Result: [a: 0, b: 0] - as Record

Last updated