Skip to content

Latest commit

 

History

History
43 lines (28 loc) · 1.38 KB

File metadata and controls

43 lines (28 loc) · 1.38 KB

CollectionGetFirstRecord_Records

A lightweight Salesforce Apex Invocable Action that returns the first record from a collection of records.
Built for use in Salesforce Flow to simplify handling record collections when only a single record is needed.


Overview

CollectionGetFirstRecord_Records accepts a list of records (List<SObject>) and returns the first full record from that list.
If the input collection is null or empty, the action safely returns null.

This utility helps reduce unnecessary Flow loops and assignments.


Features

  • Flow-ready using @InvocableMethod
  • Works with any SObject
  • Null-safe and empty-collection safe
  • No DML or SOQL
  • Uses with sharing to respect org security

Common Use Cases

  • Extract a single record from a Get Records result in Flow
  • Simplify Flow logic where only the first record is required
  • Reusable utility across multiple Flows and objects

Behavior Notes

  • The first record returned is based on the existing order of the record collection
  • No sorting or filtering is performed by the Apex action
  • If the input collection is null or empty, the returned record is null
  • The full SObject is returned as-is, including all queried fields
  • The action does not modify the input records in any way
  • Designed as a utility helper for Flow, not for bulk record processing