Cancelling an Order using API
This API cancels an order. The status of the order and its line items changes to Pending Cancellation and a new version is created. The status of the previous order is set to Being Cancelled. Please note the following:
- If you decide to revert (undo) the cancelled order, the new order version is deleted and the previous order version shows Pending status.
- If you decide to cancel the order, you must accept the cancellation of the order. After accepting the cancellation, a new version is created showing with Cancelled status for the order as well as its line items. In this case, the previous version shows the Superseded status for the order and its line items.
API Details
API |
Signature |
---|---|
cancelOrder |
|
Parameters |
|||
---|---|---|---|
Name |
Type |
Required? |
Description |
request |
|
Yes |
The request data object. |
Request Data Object - Apttus_Config2.CPQStruct.CancelOrderRequestDO |
|||
---|---|---|---|
Field |
Type |
Required? |
Description |
orderId |
|
Yes |
Unique identifier of the order to be cancelled. |
API Response
Response Data Object - CPQStruct.CancelOrderResponseDO |
||
---|---|---|
Field |
Type |
Description |
cancelOrderSO |
Standard Data Object <Apttus_Config2__Order__c> |
The fields of the Cancel Order Object. |
Code Sample
The following code sample allows you to cancel an order.
Id orderId = 'a2n6C000000Dj0r'; Apttus_Config2.CPQStruct.CancelOrderRequestDO request = new Apttus_Config2.CPQStruct.CancelOrderRequestDO(); request.OrderId = orderId; Apttus_Config2.CPQStruct.CancelOrderResponseDO result = Apttus_Config2.OrderWebService.cancelOrder(request); system.debug('order object with reverted changes'+result.CancelOrderSO);
Integration Details
Use the following information in your integrations with Conga CPQ Web Services API. Refer to Integrate Conga with External Systems for information on how to get started.
API Prerequisites
None.
Request and Response XML
Example Request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ord="http://soap.sforce.com/schemas/class/Apttus_Config2/OrderWebService" xmlns:cpq="http://soap.sforce.com/schemas/class/Apttus_Config2/CPQStruct"> <soapenv:Header> <ord:SessionHeader> <ord:sessionId>00D7A0000009QII!ARUAQFmpeBOmsYS2JcADxYc4PxWoOkAHJP1JiNo5vtvnDBCEvfnWWWmO7pqbEXY7WadiCmm_Vib6MjhmgUbR8321tIO1NQRg</ord:sessionId> </ord:SessionHeader> </soapenv:Header> <soapenv:Body> <ord:cancelOrder> <ord:request> <cpq:OrderId>a2n7A0000002tviQAA</cpq:OrderId> </ord:request> </ord:cancelOrder> </soapenv:Body> </soapenv:Envelope>
Example Response
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://soap.sforce.com/schemas/class/Apttus_Config2/OrderWebService" xmlns:CancelOrderResponseDO="http://soap.sforce.com/schemas/class/Apttus_Config2/CPQStruct" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <cancelOrderResponse> <result> <CancelOrderResponseDO:CancelOrderSO xsi:type="Apttus_Config2__Order__c"> <Id>a2n7A0000002twXQAQ</Id> <Apttus_Config2__AutoActivateOrder__c>false</Apttus_Config2__AutoActivateOrder__c> <Apttus_Config2__BillToAccountId__c>0017A00000WW0pZQAT</Apttus_Config2__BillToAccountId__c> <Apttus_Config2__BillingPreferenceId__c>a2d2f0000000h0YAAQ</Apttus_Config2__BillingPreferenceId__c> <Apttus_Config2__ConfigurationSyncDate__c>2020-07-06T08:43:16.000Z</Apttus_Config2__ConfigurationSyncDate__c> <Apttus_Config2__IsTaskPending__c>false</Apttus_Config2__IsTaskPending__c> <Apttus_Config2__OrderAmount__c>300.00000</Apttus_Config2__OrderAmount__c> <Apttus_Config2__OrderDate__c>2020-07-06T06:33:53.000Z</Apttus_Config2__OrderDate__c> <Apttus_Config2__OriginalOrderNumber__c>O-00005958</Apttus_Config2__OriginalOrderNumber__c> <Apttus_Config2__PreviousVersion__c>a2n7A0000002tviQAA</Apttus_Config2__PreviousVersion__c> <Apttus_Config2__PriceListId__c>a173C000000fHFQQA2</Apttus_Config2__PriceListId__c> <Apttus_Config2__PricingDate__c>2020-07-06T06:33:53.000Z</Apttus_Config2__PricingDate__c> <Apttus_Config2__ReadyForWorkflow__c>false</Apttus_Config2__ReadyForWorkflow__c> <Apttus_Config2__ShipToAccountId__c>0017A00000WW0pZQAT</Apttus_Config2__ShipToAccountId__c> <Apttus_Config2__SoldToAccountId__c>0017A00000WW0pZQAT</Apttus_Config2__SoldToAccountId__c> <Apttus_Config2__SourceChannel__c>Direct</Apttus_Config2__SourceChannel__c> <Apttus_Config2__Source__c>Account</Apttus_Config2__Source__c> <Apttus_Config2__Status__c>Pending Cancellation</Apttus_Config2__Status__c> <Apttus_Config2__Type__c>New</Apttus_Config2__Type__c> <Apttus_Config2__VersionNumber__c>1</Apttus_Config2__VersionNumber__c> <CurrencyIsoCode>USD</CurrencyIsoCode> </CancelOrderResponseDO:CancelOrderSO> </result> </cancelOrderResponse> </soapenv:Body> </soapenv:Envelope>