0

I want to update the order summery item price and quantify, to archive it i am trying to follow below solutions none of them worked for me. Do anyone here have any idea on what is the issue

I am trying to make callout to

"/commerce/order-management/order-summaries/orderSummaryId/actions/adjust-item-submit"

but in response i am getting error that [{"errorCode":"NOT_FOUND","message":"The requested resource does not exist"}]. I am following the documentation doc from salesforce but not sure what i am missing here.

my code

    String baseUrl = Url.getOrgDomainUrl().toExternalForm()+'/services/data/v58.0';
    String resourcePath = '/commerce/order-management/order-summaries/orderSummaryId/actions/adjust-item-submit';
    String endpointUrl = baseUrl + resourcePath;
    //Map<String, Object> requestBody = new Map<String, Object>{ 'orderId' => orderId,'orderLifeCycleType' => 'MANAGED'};
    String requestBodyJson = '{ "adjustItems": [{ "reason": "Unknown", "amount": 191.32, "appeasementType": "AmountWithoutTax", "orderItemSummaryId": "10uO40000006WoQIAU", "description": "foobar" }], "allocatedItemsChangeOrderType": "Disallowed" }';
    HttpRequest httpRequest = new HttpRequest();
    httpRequest.setEndpoint(endpointUrl);
    httpRequest.setMethod('POST');
    httpRequest.setHeader('Authorization', 'Bearer '+ PV_CC_CustomProductPricingService.getAccesToken());
    httpRequest.setHeader('Content-Type', 'application/json');
    httpRequest.setBody(requestBodyJson);        
    Http http = new Http();
    HttpResponse httpResponse = http.send(httpRequest);
    String responseJson = httpResponse.getBody();
    system.debug(responseJson);

I also used the connectApi

ConnectApi.AdjustOrderItemSummaryInputRepresentation adj = new 
ConnectApi.AdjustOrderItemSummaryInputRepresentation();
ConnectApi.AdjustItemInputRepresentation adj2 = new 
ConnectApi.AdjustItemInputRepresentation();
adj2.adjustmentType = 'AmountWithoutTax';
adj2.amount = 191.32;
adj2.orderItemSummaryId = '10uO40000006WoQIAU';
adj2.reason = 'create AdjustItem';
List<ConnectApi.AdjustItemInputRepresentation> adj4 = new 
List<ConnectApi.AdjustItemInputRepresentation>();
adj4.add(adj2);
adj.adjustItems = adj4;
ConnectApi.AdjustOrderSummaryOutputRepresentation.adjustSubmit('10uO40000006WoQIAU', adj);

But here also i am getting error

Method does not exist or incorrect signature: void adjustSubmit(String, ConnectApi.AdjustOrderItemSummaryInputRepresentation) from the type ConnectApi.AdjustOrderSummaryOutputRepresentation

Also tried to update the Order Item Summary Input Representation.

ConnectApi.OrderItemSummaryInputRepresentation orderItemSummaryInput = new 
ConnectApi.OrderItemSummaryInputRepresentation();
orderItemSummaryInput.orderItemSummaryId = '10uO40000006WoQIAU';
orderItemSummaryInput.quantity = 3;
ConnectApi.OrderItemSummaryCreation.updateOrderItemSummary(orderItemSummaryInput);

Do anyone have any idea why i am not able to processed here.

1 Answer 1

0

The first error is because orderSummaryId should be the ID of the order summary, not the literal value orderSummaryId. The "NOT_FOUND" error means that the ID couldn't be found.


The second error is because:

ConnectApi.AdjustOrderSummaryOutputRepresentation.adjustSubmit('10uO40000006WoQIAU', adj);

Should be:

ConnectApi.OrderSummary.adjustSubmit('10uO40000006WoQIAU', adj);

The third error is likewise the same:

ConnectApi.OrderItemSummaryCreation.updateOrderItemSummary(orderItemSummaryInput);

Should be something else. I couldn't find the exact method in the documentation. Make sure you're checking the documentation carefully.

1
  • Thanks sfdcfox, Could you please help me to understand is it possible to update the quantity and price of of OrderItemSummary or ass new product to order sand its order product summery once order is created. As we have split shipment so that each shipment have different pricing each time its when the product is shipped.
    – Anu
    Nov 28, 2023 at 19:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .