An administrator needs to ensure that when an Opportunity is closed won, a related custom object called Project is automatically created with specific values mapped from the opportunity. What is the most efficient declarative tool to use?
Trap 1: A Workflow Rule with a field update.
A Workflow Rule field update can only modify fields on the triggering Opportunity or its master, never create a new Project record. It is tempting because workflow rules are declarative and fire on criteria such as Closed Won, but record creation on a separate custom object requires a Flow.
Trap 2: An Apex Trigger.
An Apex Trigger is code, not declarative, so it fails the requirement for the most efficient declarative tool and adds maintenance overhead. It is tempting because triggers can create records on any object with full control, and would be correct where declarative limits are exceeded or complex logic is needed.
Trap 3: A Process Builder with an action to create a record.
Process Builder is retired and superseded by Flows.
- A
A Workflow Rule with a field update.
Why it fails: A Workflow Rule field update can only modify fields on the triggering Opportunity or its master, never create a new Project record. It is tempting because workflow rules are declarative and fire on criteria such as Closed Won, but record creation on a separate custom object requires a Flow.
- B
An Apex Trigger.
Why it fails: An Apex Trigger is code, not declarative, so it fails the requirement for the most efficient declarative tool and adds maintenance overhead. It is tempting because triggers can create records on any object with full control, and would be correct where declarative limits are exceeded or complex logic is needed.
- C
A Process Builder with an action to create a record.
Why it fails: Process Builder is retired and superseded by Flows.
- D
A record-triggered Flow configured for After-Save.
An after-save record-triggered Flow runs once the Opportunity is committed to the database, so the closed-won status and Id are available for mapping into the new Project record. This declarative approach satisfies the automatic creation and field-mapping requirement without Apex code.