Salesforce Certified Platform Developer II — Question 54
A custom field Exec_Count_c of type Number is created on an Account object. An account record with value of "1" for a: Exec_Count_c is saved. A workflow field update is defined on the Exec_Count_c field, to increment its value every time an account record is created or updated. The following trigger is defined on the account: trigger ExecOrderTrigger on Account (before insert, before update, after insert, after update){ for (Account accountInstance: Trigger.New){ if (Trigger . isBefore){ accountInstance Exec_Count_c += 1; } System. debug
(accountInstance.Exec_Count_c); } }
Answer options
- A. 1, 2, 3, 3
- B. 1, 2, 3, 4
- C. 2, 2, 4, 4
- D. 2, 2, 3, 3
Correct answer: C
Explanation
The correct answer is C because when the account is created, the Exec_Count_c is incremented to 2 during the before insert trigger. On subsequent updates, the workflow will continue to increment the value, resulting in 4 after the second update. The other options do not correctly reflect the incrementing behavior defined in the trigger and workflow field update.