Skip to content

Commit

Permalink
toValuesOf Fixgit fetch origin (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
pgajek2 authored Oct 31, 2023
1 parent 29232ac commit e854cb5
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions force-app/main/default/classes/SOQL.cls
Original file line number Diff line number Diff line change
Expand Up @@ -547,11 +547,10 @@ public virtual inherited sharing class SOQL implements Queryable {
public Set<String> toValuesOf(SObjectField fieldToExtract) {
// https://salesforce.stackexchange.com/questions/393308/get-a-list-of-one-column-from-a-soql-result
builder.fields.clearAllFields(); // other fields not needed
try {
return new Map<String, SObject>(with(fieldToExtract, 'Id').groupBy(fieldToExtract).toAggregated()).keySet();
} catch (ListException e) { // Row with null Id at index: 0
return new Set<String>();
}
return new Map<String, SObject>(with(fieldToExtract, 'Id')
.whereAre(Filter.with(fieldToExtract).isNotNull())
.groupBy(fieldToExtract).toAggregated())
.keySet();
}

public Integer toInteger() {
Expand Down

1 comment on commit e854cb5

@vercel
Copy link

@vercel vercel bot commented on e854cb5 Oct 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.