🚀 Welcome to MDriven Learn –  Don’t miss the latest Release Notes.
OCLOperators first
The first operator returns the first element in the collection it is applied to. If the operand is not already a collection, it is converted to a list before evaluation.

Syntax

collection->first

Examples

Customer.allInstances->first

Returns the first Customer object in the system.

self.Orders->first

Returns the first Order linked to the current Customer.

Customer.allinstances->select(a|a.Age>50)->first

Returns the first Customer older than 50.