New Year Sale 2026! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Salesforce Certified Platform Developer II (Plat-Dev-301) Exam - Topic 1 Question 81 Discussion

Actual exam question for Salesforce's Salesforce Certified Platform Developer II (Plat-Dev-301) exam
Question #: 81
Topic #: 1
[All Salesforce Certified Platform Developer II (Plat-Dev-301) Questions]

A developer has working business logic code, but sees the following error in the test class:

You have uncommitted work pending. Please commit

or rollback before calling out.

What is a possible solution?

Show Suggested Answer Hide Answer
Suggested Answer: B

Contribute your Thoughts:

0/2000 characters
Marylou
3 months ago
Not sure about rewriting the whole logic, that sounds risky.
upvoted 0 times
...
Bernardo
3 months ago
Is calling support really necessary? Seems like overkill.
upvoted 0 times
...
Danica
4 months ago
Wow, I didn't know about that RunningTes trick!
upvoted 0 times
...
Alayna
4 months ago
I disagree, setting seeAllData to true isn't a good practice.
upvoted 0 times
...
Eileen
4 months ago
Option B is the way to go! Just use RunningTes={} to avoid that error.
upvoted 0 times
...
Kathrine
4 months ago
Option D seems like a lot of work; I feel like there might be a simpler way to handle this without rewriting everything.
upvoted 0 times
...
Ma
4 months ago
I don't recall seeing anything about `seeAllData` being a good practice in tests, so option C seems off to me.
upvoted 0 times
...
Dong
4 months ago
I think option B sounds familiar; using `Test.startTest()` and `Test.stopTest()` might help with the callout issue.
upvoted 0 times
...
Elliot
5 months ago
I remember something about needing to commit or rollback before making callouts in tests, but I'm not sure which option addresses that directly.
upvoted 0 times
...
Emeline
5 months ago
Rewriting the business logic and test classes with @Testvisible sounds like a lot of work. I'd want to exhaust the other options first before going down that path. Let me think this through step-by-step.
upvoted 0 times
...
Teresita
5 months ago
Setting seeAllData to true? I'm not sure that's the best approach. Isn't that kind of a hack? I'd want to understand the root cause of the issue before trying something like that.
upvoted 0 times
...
Bettyann
5 months ago
Hmm, the error message suggests there's some kind of uncommitted work. I wonder if I can use the mast.T=RunningTes={} trick to bypass it in the test. That might be the easiest solution.
upvoted 0 times
...
Rolande
5 months ago
This looks like a tricky one. I'm not sure if it's an external code error or something in the test class. I'll need to think through the options carefully.
upvoted 0 times
...
Arminda
5 months ago
The permanent tester who found most defects in the original system seems like they would have the best understanding of the system, so I'm leaning towards that as the answer.
upvoted 0 times
...
Abraham
5 months ago
This seems like a straightforward question about permissions and visibility in the AutoCreate form. I'll need to carefully read through the options to determine the correct answer.
upvoted 0 times
...

Save Cancel