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:

Roosevelt
1 days 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
...
Kenneth
18 days 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
Jacquelyne
1 days ago
I agree, removing the savepoint and rollback calls seems like the best solution.
upvoted 0 times
...
...
Avery
18 days ago
But wouldn't removing the Database.setSavepoint and Database.rollback also solve the issue?
upvoted 0 times
...
Tracey
19 days ago
I agree with Kristofer. Using an @future method will prevent the 'uncommitted work pending' error.
upvoted 0 times
...
Kristofer
21 days 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