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?

QuestionsCategory: Certified Platform Developer IIA 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?
Admin Staff asked 4 months ago
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.
 Image
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?

A. Remove the Database.setSavepoint and Database.rollback.

B. Change the CalloutUtil.makeRestCallout to an @InvocableMethod method.

C. Change the CalloutUtil.makeRestCallout to an @future method.

D. Move the CalloutUtil.makeRestCallout method call below the catch block.








 

Suggested Answer: C

Community Answer: C



This question is in Certified Platform Developer II Exam
For getting Salesforce Certified Platform Developer II











Disclaimers:
The website is not related to, affiliated with, endorsed or authorized by Salesforce. 
Trademarks, certification & product names are used for reference only and belong to Salesforce.
The website does not contain actual questions and answers from Salesforce's Certification Exams.

Recommended

Welcome Back!

Login to your account below

Create New Account!

Fill the forms below to register

Retrieve your password

Please enter your username or email address to reset your password.