This API creates a cart for the order referenced by OrderId.

API Details

APISignature
createCartwebService static Apttus_Config2.CPQStruct.CreateCartResponseDO createCart(Apttus_Config2.CPQStruct.CreateCartRequestDO)



Parameters
NameTypeDescription
requestCPQStruct.CreateCartRequestDOThe request data object.



Request Data Object - CPQStruct.CreateCartRequestDO
FieldTypeRequired?Description
OrderIdIDYesThe Id of the order to be associated with the cart.
PropertiesList<Config2.Property>NoThe list of properties applicable to the cart.



Data Object - Config2.Property
FieldTypeRequired?Description
NameStringYesSpecify the features applicable to the cart. Applicable values are:
  • useAdvancedApproval: Enables Advanced Approval for a cart.
  • useDealOptimizer: Enables Deal Optimizer for a cart.
ValueStringNoThe applicable values are true or false. Specifying the value as true enables the feature for a cart.


API Response

Response Data Object - CPQStruct.CreateCartResponseDO
FieldTypeDescription
CartIdIDThe Id of the newly created cart object.



Code Sample

The following code sample enables you to create a cart for a valid order with an Order Id. Using the sample, you can search for a valid order using an order number. If an order exists with the order number entered, you can create a cart using createCart(). You can invoke this API in use cases when you want to show a cart page based on the order. 


 public void createCart()
{
	if(String.isNotBlank(orderId))
	{
		// Create config properties
		List<Apttus_Config2.Property> configProps = new List<Apttus_Config2.Property>();
		
		Apttus_Config2.Property prop = new Apttus_Config2.Property();
		
		prop.Name = 'useAdvancedApproval';
		prop.Value = 'false';
		configProps.add(prop);
		
		prop = new Apttus_Config2.Property();
		prop.Name = 'useDealOptimizer';
		prop.Value = 'false';
		configProps.add(prop);
		
		// Create the request
		Apttus_Config2.CPQStruct.CreateCartRequestDO request = new Apttus_Config2.CPQStruct.CreateCartRequestDO();
		
		// Add request parameters
		request.OrderId = orderId;
		request.Properties.addAll(configProps);
   
		// Create a new cart for Order
		Apttus_Config2.CPQStruct.CreateCartResponseDO result = Apttus_Config2.OrderWebService.createCart(request);
		
		// Get the cart Id
		cartId = result.CartId;
	} else {
		ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.info, 'Invalid or Blank Order Id.'));
	}
}
CODE

Integration Details

Use the following information in your integrations with Apttus CPQ Web Services API. Refer to Integrating Apttus 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:createCart>
         <ord:request>
            <!--Optional:-->
            <cpq:OrderId>a2n7A0000002tviQAA</cpq:OrderId>
         </ord:request>
      </ord:createCart>
   </soapenv:Body>
</soapenv:Envelope>
XML

Example Response

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://soap.sforce.com/schemas/class/Apttus_Config2/OrderWebService" xmlns:CreateCartResponseDO="http://soap.sforce.com/schemas/class/Apttus_Config2/CPQStruct">
   <soapenv:Body>
      <createCartResponse>
         <result>
            <CreateCartResponseDO:CartId>a1I7A000001IqcfUAC</CreateCartResponseDO:CartId>
         </result>
      </createCartResponse>
   </soapenv:Body>
</soapenv:Envelope>
XML