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:

Kenneth
9 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
...
Avery
9 days ago
But wouldn't removing the Database.setSavepoint and Database.rollback also solve the issue?
upvoted 0 times
...
Tracey
10 days ago
I agree with Kristofer. Using an @future method will prevent the 'uncommitted work pending' error.
upvoted 0 times
...
Kristofer
12 days ago
I think we should change the CallousUtil.makeRestCallout to an @future method.
upvoted 0 times
...

Save Cancel