Salesforce Platform Developer I (legacy) — Question 222
For which example task should a developer use a trigger rather than a workflow rule?
Answer options
- A. To set the Name field of an expense report record to Expense and the Date when it is saved
- B. To send an email to a hiring manager when a candidate accepts a job offer
- C. To notify an external system that a record has been modified
- D. To set the primary Contact on an Account record when it is saved
Correct answer: D
Explanation
A trigger is used for tasks that require immediate execution of code when records are created or updated, such as setting the primary Contact on an Account record. Workflow rules are more suited for automated actions like sending emails or notifications, but they cannot handle complex logic or interact with external systems as effectively as triggers.