Salesforce
PDII · Question #401
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 CalloutUtil.makeRestCallout fails with a 'You…
The correct answer is C. Change the CalloutUtil.makeRestCallout to an @future method. See the full explanation below for the reasoning.
Question
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 CalloutUtil.makeRestCallout fails with a 'You have uncommitted work pending. Please commit or rollback before calling out' error. What should be done to address the problem?
Exhibit
Options
- ARemove the Database.setSavepoint and Database.rollback.
- BChange the CalloutUtil.makeRestCallout to an @InvocableMethod method.
- CChange the CalloutUtil.makeRestCallout to an @future method.
- DMove the CalloutUtil.makeRestCallout method call below the catch block.
How the community answered
(51 responses)- A4% (2)
- B16% (8)
- C73% (37)
- D8% (4)
Community Discussion
No community discussion yet for this question.
