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 Exam Platform Developer II Topic 2 Question 107 Discussion

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

A company has code to update a Request and Request Lines and make a callout to

their external ERP system's REST endpoint with the updated records.

The callousUtil.makeRestCallout fails with a "You have uncommitted work pending. Please commit or rollback before calling cut' error.

What should be done to address the problem?

Show Suggested Answer Hide Answer

Contribute your Thoughts:

Germaine
1 months ago
I'm going with option B. Removing the savepoint and rollback sounds like the logical fix. Although, I can't help but imagine the developer who wrote this code must have had a really hard time with their keyboard. 'callousUtil' indeed!
upvoted 0 times
...
Dana
1 months ago
Option B is the way to go here. Removing the savepoint and rollback calls should resolve the issue. Although, I can't help but wonder - who named this method 'callousUtil'? Seems a bit on the nose, don't you think?
upvoted 0 times
Herman
4 days ago
Yeah, the name 'callousUtil' does seem a bit harsh for a method dealing with REST callouts.
upvoted 0 times
...
Glenna
8 days ago
I agree, changing the callousUtil method to an @future method might also work.
upvoted 0 times
...
Daniel
12 days ago
Option B is the way to go here. Removing the savepoint and rollback calls should resolve the issue.
upvoted 0 times
...
...
Alishia
1 months ago
Hmm, turning the makeRestCallout into an @future method might work, but it seems like a bit of a band-aid solution. I'd go with option B and remove the savepoint and rollback calls. That way, the transaction can be properly committed before the callout is made.
upvoted 0 times
Micah
24 days ago
I think removing the savepoint and rollback calls is the safer option.
upvoted 0 times
...
Jimmie
28 days ago
But wouldn't changing the makeRestCallout to an @future method also work?
upvoted 0 times
...
Chandra
1 months ago
I agree, removing the savepoint and rollback calls seems like the best solution.
upvoted 0 times
...
...
Roosevelt
2 months ago
This is a tricky one. The error message indicates that there is some outstanding work that needs to be committed before the callout can be made. Option B seems like the right fix, as it removes the savepoint and rollback, which could be causing the issue.
upvoted 0 times
Rebeca
7 days ago
Let's go ahead and make that change and see if it resolves the error.
upvoted 0 times
...
Shawna
16 days ago
I agree, removing the savepoint and rollback should fix the issue.
upvoted 0 times
...
Tanesha
30 days ago
I think option B is the best solution here.
upvoted 0 times
...
...
Kenneth
2 months ago
Hmm, I think the issue here is that the makeRestCallout method is being called before the transaction is committed. Changing it to an @InvocableMethod won't solve the problem, as the error is still related to the uncommitted work. I'd go with option B - removing the savepoint and rollback calls.
upvoted 0 times
Willie
14 days ago
Makes sense, thanks for clarifying.
upvoted 0 times
...
Tawna
15 days ago
I don't think so, the issue is with the uncommitted work, so removing the savepoint and rollback is the way to go.
upvoted 0 times
...
Janae
1 months ago
But wouldn't changing the makeRestCallout to an @future method also work?
upvoted 0 times
...
Jacquelyne
2 months ago
I agree, removing the savepoint and rollback calls seems like the best solution.
upvoted 0 times
...
...
Avery
2 months ago
But wouldn't removing the Database.setSavepoint and Database.rollback also solve the issue?
upvoted 0 times
...
Tracey
2 months ago
I agree with Kristofer. Using an @future method will prevent the 'uncommitted work pending' error.
upvoted 0 times
...
Kristofer
2 months ago
I think we should change the CallousUtil.makeRestCallout to an @future method.
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