Salesforce Decode
Salesforcedecode
Back to questions
ApexArchitect (Hardest)calloutsplatform-eventsintegration

Migrate synchronous trigger callouts to event-driven integration pattern

Real World Scenario

Legacy triggers make synchronous HTTP callouts on Case update causing user save timeouts and uncommitted work pending errors.

Expected Answer

• Remove callout from trigger; publish Integration_Requested__e with Case Id • Queueable or PE subscriber performs callout in separate transaction • Case shows Integration_Status__c Pending until subscriber confirms • Idempotent subscriber checks external system before duplicate POST • Rollback user transaction unaffected by external API latency • Migration: feature flag toggling sync vs async path during UAT • Monitor subscriber lag and error rate post-migration

Follow-Up Questions & Answers

Click to expand — each follow-up includes a direct, interview-ready answer

Main difference: use case and scale. Remove callout from trigger; publish Integration_Requested__e with Case Id. Queueable or PE subscriber performs callout in separate transaction. Pick based on your integration pattern and team capability. Sync callout in trigger is legacy debt—every user save path audit should flag them. Document the decision in an ADR and align with enterprise standards.

Architect Perspective

Sync callout in trigger is legacy debt—every user save path audit should flag them.