Salesforce Certified Platform Developer II Practice Questions

Salesforce Certified Platform Developer II exam preparation

Salesforce Certified Platform Developer II practice questions in English: 180 questions with explanations. The mock exam has 60 questions and 120 minutes.

Salesforce Certified Platform Developer II free question 2 / 10 · Domain 2: Process Automation, Logic, and Integration

Two separate teams each wrote a before insert trigger on Case. Trigger A sets the priority, and trigger B reads the priority to choose the owning queue. Everything worked in testing, but in production it looks as if B ran before A. Which statement matches the documentation?

  1. A trigger saved with a newer API version runs before one saved with an older version
  2. Triggers on the same object run in alphabetical order of their names
  3. When several triggers are defined for the same event, the order of execution isn't guaranteed
  4. Triggers run in the order they were created, so the older trigger runs first
Show the answer and explanation

Answer: C

Why this is correct
The "Additional Considerations" section of the order of execution page says that if more than one trigger is defined on an object for the same event, the order of trigger execution isn't guaranteed. Its example matches this case: with two before insert triggers for Case, when a new Case record is inserted, the firing order of the two triggers isn't guaranteed. Trigger B must therefore not depend on A having already run.

Why the other options are wrong
"Triggers run in the order they were created, so the older trigger runs first" … The page names no ordering by creation date. It says the order is not guaranteed when more than one trigger is defined on an object for the same event.
"Triggers on the same object run in alphabetical order of their names" … Alphabetical order by name is not described anywhere on the page. The statement is that the firing order of triggers on the same object and event isn't guaranteed.
"A trigger saved with a newer API version runs before one saved with an older version" … The page doesn't tie the order of execution to the API version a trigger was saved with. It says the firing order of triggers for the same event is not guaranteed.

Where the guarantee stops
The page does guarantee the order of the steps themselves: all before triggers run before the system validation that runs again, then duplicate rules are executed, the record is saved without a commit, and all after triggers run. The lack of a guarantee applies only inside one step, among several triggers of the same type on the same object.

Go to the Salesforce Certified Platform Developer II practice app (10 free questions; purchase unlocks all questions)

See the full practice set