Cancel Cart Items

In a supplemental order, this API provides the ability to cancel a line item. When you cancel a line item, you are cancelling the change that is represented by that line item.

This lists includes several examples:

  • When the action for the line item action is Add, then the user’s intent in the original order was to add a new asset to the account. Cancelling that action in a supplemental order means the new asset is not added.

  • When the action for the line item action is Change, the user’s intent in the original order was to make changes to an asset through the MACD Asset-based Order Item record. Cancelling that action in a supplemental order implies the user did not want to make the change. So, the asset configuration does not change.

  • When the action for the line item action is Disconnect, the user’s intent in the original order was to disconnect the asset. Cancelling that action in a supplemental order implies the user no longer wants to disconnect the asset, so, the asset is not disconnected through the supplemental order.

  • When the action for the line item action is Existing, the user’s intent in the original order was to make changes to a related line item that was pulled in from the Account. Cancelling that action in a supplemental order means you are not making any changes to that particular line item.

REST 

Not available. There is no REST endpoint for this API.

How to Invoke this API 

To invoke this API, use the following APEX method:

1/**
2* This method can be used to create a followOn order.
3* Inputs:
4* orderId - Id. The original order's Id.
5**/
6public static void createFollowOnOrder(Id orderId)
7{
8    final String methodName = 'cancelCartItems';
9    Map<String, Object> inputMap = new Map<String, Object>
10    {
11        'cartId' => orderId,
12        'itemIds' => new List<Id> { 'rootItemId' },
13        'methodName' => methodName
14    };
15    Map<String, Object> outputMap = new Map<String, Object>();
16    Map<String, Object> optionsMap = new Map<String, Object>();
17    vlocity_cmt.CpqAppHandler handler = new vlocity_cmt.CpqAppHandler();
18    handler.invokeMethod(methodName, inputMap, outputMap, optionsMap);
19    // traverse the result that was returned, to find the followOn order id.
20    vlocity_cmt.JSONResult result = (vlocity_cmt.JSONResult) outputMap.get('result');
21}

Example 1 - Create an Amend Order 

CPQ uses this flow to create an Amend order.

Example 2 - Create a Cancel Order 

CPQ uses this flow to create a Cancel order.

Example 3 - Discard a Supplemental Order 

To discard the supplemental order, set the supplemental order’s OrderStatus__c = Discarded.