Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.toValuesOf returning empty set when one of extracted values is null #90

Closed
szczursonn opened this issue Oct 31, 2023 · 0 comments · Fixed by #91
Closed

.toValuesOf returning empty set when one of extracted values is null #90

szczursonn opened this issue Oct 31, 2023 · 0 comments · Fixed by #91
Assignees
Labels
bug Something isn't working

Comments

@szczursonn
Copy link

SOQL's .toValuesOf(field) method returns an empty Set when one of the queried records has the field as null

STEPS TO REPRODUCE

  1. Create two Account records: one where Industry field is null, and one where Industry field is populated
  2. Run a query with .toValuesOf:
System.debug(SOQL.of(Account.sObjectType).toValuesOf(Account.Industry));
// {}
  1. Run the same query, but filter out null values from the field:
System.debug(SOQL.of(Account.sObjectType).whereAre(SOQL.Filter.with(Account.Industry).isNotNull()).toValuesOf(Account.Industry));
// {Education, Mining, Manufacturing...}

Expected behavior

.toValuesOf(field) returns a Set with all values when extracting a nullable field, including null

@pgajek2 pgajek2 self-assigned this Oct 31, 2023
@pgajek2 pgajek2 added the bug Something isn't working label Oct 31, 2023
@pgajek2 pgajek2 linked a pull request Oct 31, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants