Northern Trail Outfitters needs a synchronous callout from Salesforce to an Order Management System (OMS) when an opportunity is "Closed/Won" with products attached. What should an integration architect do to satisfy these requirements?
A.
Build a Lightning component that makes a synchronous Apex REST callout to the OMS when a button is clicked.
B.
Write a trigger that invokes an Apex proxy class to make a REST callout to the OMS.
C.
Develop a batch Apex job that aggregates closed opportunities and makes a REST callout to the OMS hourly.
To satisfy a requirement for a synchronous callout triggered by a user action, the architect should use a UI-driven approach, such as a Lightning component and a button.
In Salesforce, triggers (Option B) are primarily used for asynchronous logic in integration contexts. Because a trigger executes as part of the database save operation, making a synchronous callout directly from a trigger is prohibited as it would block the database transaction until the external system responds, leading to performance degradation and "uncommitted work pending" errors. If a trigger must initiate an integration, it must do so asynchronously (using @future or Queueable Apex), which violates the requirement for a synchronous call.
By using a Lightning component, the architect can initiate a synchronous Request-and-Reply pattern. When the sales rep clicks the "7Submit to OMS" button, the componen8t invokes an Apex method that makes the REST callout to the OMS in real-time. The user remains on the page while the system waits for the OMS to respond, allowing for immediate feedback—such as an order confirmation number or an error message—to be displayed in the UI. A Batch Apex job (Option C) is inherently asynchronous and delayed, making it unsuitable for a synchronous, real-time fulfillment requirement.
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit