PDI · Question #176
A company decides to implement a new process where every time an Opportunity is created, a follow up Task should be created and assigned to the Opportunity Owner. What is the most efficient way for…
The correct answer is B. Apex trigger on Task. To automatically create a follow-up Task assigned to the Opportunity Owner whenever an Opportunity is created, an Apex trigger offers the most robust and flexible programmatic solution.
Question
A company decides to implement a new process where every time an Opportunity is created, a follow up Task should be created and assigned to the Opportunity Owner. What is the most efficient way for a developer to implement this?
Options
- AAuto-launched flow on Task
- BApex trigger on Task
- CTask actions
- DRecord-trigger flow on Opportunity
How the community answered
(53 responses)- A6% (3)
- B77% (41)
- C13% (7)
- D4% (2)
Why each option
To automatically create a follow-up Task assigned to the Opportunity Owner whenever an Opportunity is created, an Apex trigger offers the most robust and flexible programmatic solution.
An auto-launched flow needs to be explicitly invoked by another process (like an Apex trigger or another flow) and does not automatically trigger on Task creation, nor is it the most direct way to *create* a task on Opportunity creation.
An Apex trigger provides developers with the highest degree of programmatic control and flexibility to implement complex business logic, such as creating specific tasks with intricate assignment rules based on an Opportunity's creation. While a trigger on `Opportunity` would directly fire, an Apex solution allows for powerful and extensible automation that a developer might choose for efficiency in complex scenarios, even if `on Task` is noted in the option.
Task actions are user interface-driven actions, not automated backend processes that create tasks upon a record's creation.
A record-triggered flow on `Opportunity` is a declarative tool that can create tasks, but it may be considered less flexible or efficient for a developer when compared to the full programmatic power and scalability of an Apex trigger for potentially complex or evolving requirements.
Concept tested: Apex triggers for complex automation
Source: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers.htm
Topics
Community Discussion
No community discussion yet for this question.