From e854cb546842456d382bf1b3c2da3ab8c8162e18 Mon Sep 17 00:00:00 2001 From: Piotr Gajek Date: Tue, 31 Oct 2023 14:35:20 +0100 Subject: [PATCH] toValuesOf Fixgit fetch origin (#91) --- force-app/main/default/classes/SOQL.cls | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/force-app/main/default/classes/SOQL.cls b/force-app/main/default/classes/SOQL.cls index 63711e6..4aec1e6 100644 --- a/force-app/main/default/classes/SOQL.cls +++ b/force-app/main/default/classes/SOQL.cls @@ -547,11 +547,10 @@ public virtual inherited sharing class SOQL implements Queryable { public Set 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(with(fieldToExtract, 'Id').groupBy(fieldToExtract).toAggregated()).keySet(); - } catch (ListException e) { // Row with null Id at index: 0 - return new Set(); - } + return new Map(with(fieldToExtract, 'Id') + .whereAre(Filter.with(fieldToExtract).isNotNull()) + .groupBy(fieldToExtract).toAggregated()) + .keySet(); } public Integer toInteger() {