CertyRush
Đang tải...
C CertyRush
Câu hỏi free preview

Câu 61: Certified Platform Developer II

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 = new HttpRequest(); req.setEndpoint('https://www.example.org/v1/order…

Nội dung câu hỏi

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 = new HttpRequest(); req.setEndpoint('https://www.example.org/v1/orders'); 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 pendingWhat should the developer do? (Choose two.)

Các lựa chọn

Đáp án được giữ gọn theo nhãn A, B, C, D trong phần bình chọn tương tác.

  1. A. Use the asyncSend() method of the HTTP class to send the request in async context
  2. B. Ensure all callouts are completed prior to executing DML statements — đáp án hiện tại
  3. C. Move the web service callout into an @future method — đáp án hiện tại
  4. D. Use Database.insert (order, true) to immediately commit any database changes

Cộng đồng

0 bình luận công khai. Tên thành viên được ẩn một phần.

Chưa có bình luận. Mở giao diện tương tác để bắt đầu thảo luận.

Câu hỏi liền kề