問題文
A textile mill needs the same pricing calculation to run from a trigger, from a screen flow that buyers use, and from an inbound endpoint that a partner calls. What design lets one implementation serve all three callers?
選択肢
- Put the calculation in three places and keep them aligned by review, because each caller has a different shape of input.
- Put the calculation in an invocable method for the flow and have the trigger and the endpoint launch that flow, because a flow can be started from Apex and this keeps the business rule in a place that administrators can maintain without a developer being involved.
- Put the calculation in the trigger and let the flow and the endpoint update the record so that the trigger fires for them too.
- Put the calculation in a service class whose methods take and return collections, and give it three thin entry points: a trigger handler, an invocable method for the flow, and an Apex REST class, because a thin entry point carries only the translation from its own caller's shape into the collection the service expects.