Cyber Monday 2024! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Salesforce Exam Platform Developer II Topic 4 Question 103 Discussion

Actual exam question for Salesforce's Platform Developer II exam
Question #: 103
Topic #: 4
[All Platform Developer II Questions]

A developer has a test class that creates test data before making a mock callout but now receives a 'You have uncommitted work pending. Please commit or rollback before calling out' error.

Which step should be taken to resolve the error?

Show Suggested Answer Hide Answer
Suggested Answer: D

Contribute your Thoughts:

Bernadine
2 months ago
Ah, the old 'You have uncommitted work pending' error. Brings back memories of that time I accidentally committed my entire life savings. Good times, good times.
upvoted 0 times
...
Hildegarde
2 months ago
I'm picking C, because I'm a rebel and I like to live on the edge. Commit? Who needs it?
upvoted 0 times
Kathrine
1 months ago
User3: I prefer option D, it's never let me down.
upvoted 0 times
...
Xenia
1 months ago
User2: I think C is the way to go, it's worked for me before.
upvoted 0 times
...
Quentin
1 months ago
I always go with option B to avoid that error.
upvoted 0 times
...
...
Donte
2 months ago
B is the way to go, my dude. Gotta keep that test data nice and tidy, you know?
upvoted 0 times
...
Gertude
2 months ago
Wait, so we have to commit or rollback before calling out? Sounds like a party trick to me.
upvoted 0 times
Cory
1 months ago
C) Ensure both the insertion and mock callout occur after the Test.startTest().
upvoted 0 times
...
Sophia
1 months ago
C: But why do we have to commit or rollback before calling out?
upvoted 0 times
...
Kattie
1 months ago
B) Ensure the records are Inserted before the Test.startTest() statement and the mock callout occurs within a method annotated with @testSetup.
upvoted 0 times
...
Carey
1 months ago
B: C) Ensure both the insertion and mock callout occur after the Test.startTest().
upvoted 0 times
...
Shonda
1 months ago
A: B) Ensure the records are Inserted before the Test.startTest() statement and the mock callout occurs within a method annotated with @testSetup.
upvoted 0 times
...
Maricela
2 months ago
A) Ensure both the Insertion and mock callout occur after the Test.startTest().
upvoted 0 times
...
...
Chun
2 months ago
I see your point, but I still think option B is the best choice based on the order of operations required to avoid the error message.
upvoted 0 times
...
Amalia
2 months ago
I disagree, I believe the answer is D. The records should be inserted before Test.startTest() and the mock callout should occur after Test.startTest().
upvoted 0 times
...
Chun
3 months ago
I think the correct step is B, because the records need to be inserted before Test.startTest() and the mock callout should be within a method annotated with @testSetup.
upvoted 0 times
...

Save Cancel
az-700  pass4success  az-104  200-301  200-201  cissp  350-401  350-201  350-501  350-601  350-801  350-901  az-720  az-305  pl-300  

Warning: Cannot modify header information - headers already sent by (output started at /pass.php:70) in /pass.php on line 77