Salesforce
PDII · Question #112
PDII Question #112: Real Exam Question with Answer & Explanation
Sign in or unlock PDII to reveal the answer and full explanation for question #112. The question stem and answer options stay visible for context.
Question
A developer writes the following code: public with sharing class OrderController() public PaqeReference sendOrder() Order_c order = new Order_c insert order; ExternalOrder externalOrder = new ExternalOrder(order); Http h = new Http(); HttpRequest req = req.setMethod('POST'); req.setBody(JSON.serialize(externalOrder)); HttpResponse res = h.send(req); order = (ExternalOrder)JSON.deserialize(res.getBody(),ExternalOrder.class); While testing the code, the developer receives the following error message: System.CalloutException : You have uncommitted work pending What should the developer do? (Choose two.)
Options
- AUse the asyncSend() method of the HTTP class to send the request in async context
- BEnsure all callouts are completed prior to executing DML statements
- CMove the web service callout into an @future method
- DUse Database.insert (order, true) to immediately commit any database changes
Unlock PDII to see the answer
You've previewed enough free PDII questions. Unlock PDII for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.