Skip to content

Add errorMessage field to Response class#5

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/add-error-message-to-response
Draft

Add errorMessage field to Response class#5
Copilot wants to merge 2 commits into
mainfrom
copilot/add-error-message-to-response

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 3, 2026

The Response class had no way to communicate why a returned record is null, leaving callers without actionable context on invalid input.

Changes

CollectionGetFirstRecord_Records.cls

  • Added @InvocableVariable String errorMessage to the Response inner class
  • Split the combined null/empty guard into two discrete checks to surface distinct messages:
    • req.records == null"Input list was null"
    • req.records.isEmpty()"Input list was empty"
    • Valid input → errorMessage remains null
public class Response {
    @InvocableVariable(label='Record' description='The first record from the provided collection')
    public SObject record;
    @InvocableVariable(label='Error Message' description='Description of why no record was returned, when applicable')
    public String errorMessage;
}

CollectionGetFirstRecord_RecordsTest.cls

  • Added assertions on errorMessage for empty and null input cases
  • Added assertion that errorMessage is null when a valid record is returned

Copilot AI linked an issue Apr 3, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Add error message field to Response class Add errorMessage field to Response class Apr 3, 2026
Copilot AI requested a review from ethandunzer April 3, 2026 18:02
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.

Add Error Message to Response

2 participants