Loading
Prepare for Email to Become the Default Login ExperienceRead More
The online Trailblazer Community becomes read-only Oct 30, 2026Read More
Important Advisory: iOS Update Impacting CG Mobile ApplicationRead More
Sales Performance Management
first

first

Returns the first item in a sorted list in Salesforce Spiff.

Required Editions

Available in: both Salesforce Classic (not available in all orgs) and Lightning Experience
Available in: Enterprise, Unlimited, and Developer Editions
Available for an additional cost in: Professional Edition with Web Services API Enabled

Syntax

first(list, sort_expression)

Arguments

Argument Required? Description
list Required The list to evaluate. Use any function that returns a list or enter a list manually. A list can contain strings, numbers, currencies, records, or objects. Enclose the list in brackets with comma-separated values.
sort_expression Optional An expression that specifies how items in the list are sorted. This argument is helpful when you're sorting values in a datasheet field. To sort records in ascending order, specify the name of the field.

Considerations

  • This function's return value is the first item in the sorted list.
  • If the list contains only one record or object, the return value is null.
  • If the list contains records or objects, each record or object has multiple fields. Specify the field you want to sort by.
  • Combine this function with other functions that return lists, such as sort() and transform_list().

Examples

Sort records in the ClosedInPeriod_ARRCommission datasheet by the values of the ARR__c field in ascending order, and return the first item.

=first(ClosedInPeriod_ARRCommission, ARR__c)

Sort the ARR__c values in ascending order, transform the list to return specific values, and then return the first value from the transformed list.

=first(transform_list(sort(ClosedInPeriod_ARRCommission, ARR__c, 1), ARR__c))
 
Loading
Salesforce Help | Article