For CME Winter ‘20 and later releases, a supplemental order can be created to amend or cancel the previous order.
For releases prior to CME Winter ‘20, any supplemental order is treated as an order cancellation. See In-Flight Order Cancellation.
1POST /v2/cpq/carts/{order_ID}/cancel
This API supports the guest user enhancements that Salesforce introduced with the Winter ‘21 release. To encrypt and decrypt data for guest users, use the UserSecurity class with this API. See Guest User Technical Details.
For additional information, see UserSecurity Class and CPQ and Digital Commerce Changes for Guest Users.
Remote Method
1createSupplementalOrder
Apex Method
Use this CpqAppHandler method with the following inputs to create a supplemental order for an order that is already in a frozen state.
currentOrdId: The ID of the current order
intentForSupplement: A string indicating the reason for creating the supplemental order, which can be Cancel (the default) or Amend. If the intent is not specified, Cancel is used.
1public static Id createSupplementalOrder(Id currentOrdId, String intentForSupplement)2{3 final String methodName = 'createSupplementalOrder';4 Map<String, Object> inputMap = new Map<String, Object>5 {6 'cartId' => currentOrdId,7 'intent' => intentForSupplement,8 'methodName' => methodName9 };10 Map<String, Object> outputMap = new Map<String, Object>();11 Map<String, Object> optionsMap = new Map<String, Object>();12 vlocity_cmt.CpqAppHandler handler = new vlocity_cmt.CpqAppHandler();13 handler.invokeMethod(methodName, inputMap, outputMap, optionsMap);1415 // traverse the result that was returned, to find the supplemental order id.16 vlocity_cmt.JSONResult result = (vlocity_cmt.JSONResult) outputMap.get('result');17 vlocity_cmt.JSONRecord record = result.records[0];18 Id supplementalOrderId = (Id) record.fields.get('supplementalOrderId');19 return supplementalOrderId;20}
The createSupplementalOrder API accepts the intent parameter and its valid values: Amend and Cancel (the default). If no value is passed, it is defaulted to Cancel. If an invalid value is passed, this error code is returned.
SUPPLEMENT-1102
An internal error occurred during the createSupplementalOrder API call.
SUPPLEMENT-1103
When the createSupplementalOrder API is invoked on an original order and the IsChangesAllowed flag is set to false, this code is returned.
SUPPLEMENT-1104
When the createSupplementalOrder API is invoked on an order that is in a state other than In Progress, this error code is returned.
SUPPLEMENT-1105
When the createSupplementalOrder API is invoked on an order that requires pricing and pricing implementation errors out, then this code is returned.
SUPPLEMENT-1106
When the createSupplementalOrder API is invoked on an original order that already has a supplemental order, this code is returned.