Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam CRT-450 All Questions

View all questions & answers for the CRT-450 exam

Exam CRT-450 topic 1 question 173 discussion

Actual exam question from Salesforce's CRT-450
Question #: 173
Topic #: 1
[All CRT-450 Questions]

A developer writes a trigger on the Account object on the before update event that increments a count field. A workflow rule also increments the count field every time that an Account is created or updated. The field update in the workflow rule is configured to not re-evaluate workflow rules.
What is the value of the count field if an Account is inserted with an initial value of zero, assuming no other automation logic is implemented on the Account?

  • A. 1
  • B. 3
  • C. 4
  • D. 2
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Brauliongon
Highly Voted 3 years, 3 months ago
Is 2 The ans is 2. Trigger is only before. So during creation will do nothing. 1 create account 2. Workflow increase value to:1 3. It will be treat as a edit 4. Trigger increase to 2. 5. Workflow ignore that change 6. Done
upvoted 24 times
...
JoeColoe
Highly Voted 3 years, 2 months ago
Answer is 3. Update trigger is called twice.
upvoted 6 times
...
PriyankN
Most Recent 8 months, 3 weeks ago
Selected Answer: D
Brauliongon is correct.. I tested this in my playground..
upvoted 2 times
...
mariamarlenepereira9
10 months ago
I think it's 3 for the following reason: ... 9. Workflow rules execute 10. If there are workflow field updates, the record is updated again 11. Executes before update triggers and after update triggers, regardless of the record operation (insert or update), one more time (and only one more time) > so in my opinion the trigger is fired 2x (once when the workflow rule updates the record, and again after that. And the process ends there.
upvoted 1 times
...
Keiyo
1 year, 2 months ago
The trigger runs in the "before update" event, so it increments the count field by 1. The count field becomes 1. The workflow rule also runs and increments the count field by 1. However, since it's configured to not re-evaluate workflow rules, it doesn't re-run itself. So, it increments the count field based on the initial value, which was 1. Therefore, it becomes 2.
upvoted 2 times
...
Brinuz
1 year, 3 months ago
Selected Answer: D
D is the right answer
upvoted 3 times
...
gsori
1 year, 3 months ago
Selected Answer: D
The question in my opinion is badly worded. The docs for workflow rules provides 3 different evaluation criteria: https://help.salesforce.com/s/articleView?id=sf.workflow_rules_define.htm&type=5 But the question says that the workflow rule is configured on create and update fields events with the latter type of event configured to not fire the workflow rule a second time. So according to options on the docs, the workflow rule in reality it's configured to fire only on creation. The order of execution, https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_order_of_execution.htm, gives priority to triggers and then to workflow rules. In this case the first event is a record creation event so the trigger won't run since it's a before update trigger. So, workflow rule runs the first time on creation incrementing the field value to 1. This fires an update event that causes the before trigger to run hence incrementing the field value to 2. The workflow rule though ignores this update event, so the final field value remains 2.
upvoted 3 times
...
BeatrizBernardo
1 year, 5 months ago
Selected Answer: B
I think the correct answer is 3. I tested in an org. The explanation: - starting with count=0; - According the order of execution, before triggers are the first to run, so count = 1; - Workflow are the next execution to run, so count = 2; - but, when evaluting workflows, the triggers are executed again, so count = 3; - the execution finishes once there is no more to do and the re-evaluate workflow is not checked. so the count will be 3
upvoted 3 times
gsori
1 year, 3 months ago
It's a before update trigger so the first time won't run since it's a record creation event.
upvoted 3 times
...
...
XSOBYX
1 year, 6 months ago
The value of the count field if an Account is inserted with an initial value of zero, assuming no other automation logic is implemented on the Account, would be: C. 4 Here's the explanation: When the Account is inserted, the workflow rule increments the count field once, making it 1. Since the workflow rule is configured to not re-evaluate workflow rules, the trigger on the before update event is not fired during the initial insert. Now, if the Account is updated, the workflow rule increments the count field again, making it 2. At this point, the trigger on the before update event is fired, and it increments the count field once more, resulting in a final value of 3. However, the workflow rule does not re-evaluate during this update, so it does not increment the count field again. Therefore, the count field would have a value of 4 (initial value of 0 + 1 + 2 + 1 from the trigger) if an Account is inserted with an initial value of zero, assuming no other automation logic is implemented on the Account.
upvoted 2 times
...
moorer
1 year, 10 months ago
Agree should be 2
upvoted 2 times
...
AnanandmaniRathor
2 years ago
Right Answer is 2 ! Explanation: On insertion of new record workflow rule will run and make count to 1 ( before update trigger won't run as it's an insertion). After the workflow rule before update trigger will run and make this count to 2 and it will again comeback to workflow rule but this time due to given logic it won't re-evaluate the count and then execution will finish with count as 2 only.
upvoted 2 times
...
ApexMike
2 years, 1 month ago
Selected Answer: D
2 is correct imho
upvoted 2 times
...
PratikshaRJ
2 years, 9 months ago
Answer should be 3 (trigger fires one time and workflow fires twice on create and on update) Initially Account is created and inserted hence value becomes 1 Then the update trigger fires and value becomes 2 At last the workflow rule again fires for update and the count becomes 3
upvoted 1 times
mpetre
2 years, 1 month ago
"The field update in the workflow rule is configured to not re-evaluate workflow rules." I think this part exclude the third point, workflow fires only once
upvoted 2 times
...
ApexMike
2 years, 1 month ago
The trigger doesn't run the first time since it's an after Update not after insert.
upvoted 1 times
...
...
illyaOsiyuk
2 years, 11 months ago
Why answer is 3 ? It's not before insert/update.
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...