Salesforce Certified Platform Developer II — Question 232
Universal Containers has an Apex trigger on Account that creates an Account Plan record when an Account is marked as a Customer.
Recently a record-triggered flow was added so that whenever an Account is marked as a Customer, a ‘Customer Since’ date field is updated with today’s date. Since the addition of the flow, two Account Plan records are created whenever the Account is marked as a Customer.
What might cause this to happen?
Answer options
- A. The flow is configured to evaluate when a record is created and every time it is edited.
- B. The Apex trigger is not bulk safe and calls insert inside of a for loop.
- C. The Apex trigger does not use a static variable to ensure it only fires once.
- D. The flow is configured to use an ‘Update Records’ element.
Correct answer: A
Explanation
The correct answer is A because the flow is triggering both on the initial creation of the Account and on subsequent edits, which results in the Apex trigger executing twice. Option B is incorrect as the problem is not related to bulk safety in this scenario. Option C is not the cause since the issue arises from the flow's configuration, not the trigger's execution method. Option D is irrelevant to the duplication issue, as the flow's use of 'Update Records' does not inherently cause multiple triggers.