Skip to content

Bulk-safe request processing with per-request error isolation#7

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/optimize-for-bulk-processing
Draft

Bulk-safe request processing with per-request error isolation#7
Copilot wants to merge 2 commits into
mainfrom
copilot/optimize-for-bulk-processing

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 3, 2026

A single invalid fieldApiName in a batch would throw an unhandled SObjectException, failing the entire invocation — violating the core bulkification contract.

Changes

  • fieldApiName guardString.isBlank check short-circuits before field access; returns null response with descriptive errorMessage
  • try/catch (SObjectException) per request — invalid field names populate errorMessage for that request only; remaining requests in the batch are unaffected
  • errorMessage output variable — new @InvocableVariable on Response surfaces per-request errors back to Flow
// Before: this kills every request in the batch
reqBad.fieldApiName = 'NonExistentField__xyz'; // throws SObjectException → entire list fails

// After: bad request gets null response + errorMessage; good requests proceed normally
responses[1].response      // null
responses[1].errorMessage  // "Invalid field NonExistentField__xyz for ..."
responses[2].response      // "Good Account"  ← unaffected
  • New teststestGetFirstValue_BlankFieldApiName, testGetFirstValue_InvalidFieldApiName_DoesNotBreakBatch

Copilot AI changed the title [WIP] Fix governor limit issues by optimizing method for bulk processing Bulk-safe request processing with per-request error isolation Apr 3, 2026
Copilot AI requested a review from ethandunzer April 3, 2026 18:01
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.

No Bulkification or Governor Limit Consideration

2 participants