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.
POST /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
createSupplementalOrder
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) orAmend. If the intent is not specified,Cancelis used.
public static Id createSupplementalOrder(Id currentOrdId, String intentForSupplement)
{
final String methodName = 'createSupplementalOrder';
Map<String, Object> inputMap = new Map<String, Object>
{
'cartId' => currentOrdId,
'intent' => intentForSupplement,
'methodName' => methodName
};
Map<String, Object> outputMap = new Map<String, Object>();
Map<String, Object> optionsMap = new Map<String, Object>();
vlocity_cmt.CpqAppHandler handler = new vlocity_cmt.CpqAppHandler();
handler.invokeMethod(methodName, inputMap, outputMap, optionsMap);
// traverse the result that was returned, to find the supplemental order id.
vlocity_cmt.JSONResult result = (vlocity_cmt.JSONResult) outputMap.get('result');
vlocity_cmt.JSONRecord record = result.records[0];
Id supplementalOrderId = (Id) record.fields.get('supplementalOrderId');
return supplementalOrderId;
}
Package
Communication (vlocity_cmt)
API Parameters and Response Format
For API parameter names and descriptions, see Cart-Based API Swagger Reference.
Resource Information
| Response Format | JSON |
|---|---|
| Resource URL | /services/apexrest/{namespace}/v2/cpq/carts/{order_ID}/cancel |
Example Request
POST
/services/apexrest/v2/cpq/carts/{order_ID}/cancel
Example Request Body
{
"cartId": "order_ID",
"subaction": "createSupplementalOrder",
"intent": "Amend"
}
Message Codes
| Code | Description |
|---|---|
| SUPPLEMENT-1101 | 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. |
See Also