Skip to content

fix: change getSObjects() return type from List to RecordSet$ for for…#39

Merged
pwrightcertinia merged 1 commit intomainfrom
fix-issue-38-getSObjects-return-recordset
Aug 19, 2025
Merged

fix: change getSObjects() return type from List to RecordSet$ for for…#39
pwrightcertinia merged 1 commit intomainfrom
fix-issue-38-getSObjects-return-recordset

Conversation

@nawforce
Copy link
Contributor

…-loop compatibility

Change getSObjects() methods to return RecordSet$ instead of List to support recordset iteration in for-loops like SOQL queries and Database.query().

This enables the syntax:
for(List cursorBlock : parent.getSObjects('relationshipName')) {}

Without this fix, the above produces the error:
"Incompatible types in assignment, from 'System.SObject' to 'System.List<System.SObject>'"

Changes:

  • Add import for com.nawforce.runforce.Internal.RecordSet$
  • Change getSObjects(SObjectField) return type: List → RecordSet$
  • Change getSObjects(String) return type: List → RecordSet$

Fixes #38
Related: apex-dev-tools/apex-ls#328

…-loop compatibility

Change getSObjects() methods to return RecordSet$<SObject> instead of
List<SObject> to support recordset iteration in for-loops like SOQL queries
and Database.query().

This enables the syntax:
for(List<SObject> cursorBlock : parent.getSObjects('relationshipName')) {}

Without this fix, the above produces the error:
"Incompatible types in assignment, from 'System.SObject' to 'System.List<System.SObject>'"

Changes:
- Add import for com.nawforce.runforce.Internal.RecordSet$
- Change getSObjects(SObjectField) return type: List<SObject> → RecordSet$<SObject>
- Change getSObjects(String) return type: List<SObject> → RecordSet$<SObject>

Fixes #38
Related: apex-dev-tools/apex-ls#328
@pwrightcertinia pwrightcertinia merged commit 43a6a56 into main Aug 19, 2025
1 check passed
@pwrightcertinia pwrightcertinia deleted the fix-issue-38-getSObjects-return-recordset branch August 19, 2025 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SObject.getSObjects() should return RecordSet$ instead of List for for-loop compatibility

2 participants