Deal of The Day! 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 2 Question 20 Discussion

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?
D) Use test.IsRunningTest() before making the callout to bypass it in test execution.
A) Rewrite the business logic and test classes with TestVisible set on the callout.
B) Set seeAIIData to 'true' at the top of the test class, since the code does not fail in practice.
C) Call support for help with the target endpoint, as it is likely an external code error.

Salesforce Certified Platform Developer II (Plat-Dev-301) Exam - Topic 2 Question 20 Discussion

Actual exam question for Salesforce's Salesforce Certified Platform Developer II (Plat-Dev-301) exam
Question #: 20
Topic #: 2
[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: D

Contribute your Thoughts:

0/2000 characters
Amie
7 months ago
Not sure about C, calling support seems like overkill for this issue.
upvoted 0 times
...
Louvenia
7 months ago
A is definitely not the way to go, rewriting is too much hassle.
upvoted 0 times
...
Cherrie
7 months ago
Wait, is it really okay to bypass callouts in tests?
upvoted 0 times
...
Irving
8 months ago
I disagree, I think B could work too.
upvoted 0 times
...
Avery
8 months ago
Option D seems like the best choice here.
upvoted 0 times
...
Tammi
8 months ago
Calling support seems unnecessary; the error is likely due to the test setup. I feel like I've encountered this scenario before, but I can't recall the exact fix.
upvoted 0 times
...
Aja
8 months ago
I think rewriting the business logic with TestVisible could be overkill. I wonder if there's a simpler solution like option D.
upvoted 0 times
...
Fallon
8 months ago
I'm not entirely sure, but I think setting seeAllData to true might help. It feels like I've seen that in practice questions before.
upvoted 0 times
...
Krissy
8 months ago
I remember something about uncommitted work causing issues with callouts in tests. Maybe option D is the right way to bypass it?
upvoted 0 times
...
Jolene
8 months ago
I'm a little confused by the wording of the question. Are we looking for a measure that prevents future attacks, or one that responds to an ongoing attack? I'll have to re-read the options carefully.
upvoted 0 times
...
Stefan
8 months ago
Wait, I'm confused now. If the scatter decreases, doesn't that mean the r-squared value should get smaller, not larger? I need to review my notes on interpreting r-squared before answering this.
upvoted 0 times
...
Annabelle
8 months ago
Okay, the question is asking about the privilege level assigned to VTY users. Let me see if I can find that information in the exhibit.
upvoted 0 times
...
Madalyn
8 months ago
I think it's the "infra" tenant for in-band management, but I'm not 100% sure. Maybe I should have reviewed that more.
upvoted 0 times
...
Myra
8 months ago
I've got a good strategy for this. I'll break down the process step-by-step and critically examine each step to see where I can streamline or remove any unnecessary tasks.
upvoted 0 times
...

Save Cancel