This API creates a cart for the quote or proposal referenced by QuoteID. The quote or proposal must be associated with a price list.



APISignature
createCartwebService static Apttus_CPQApi.CPQ.CreateCartResponseDO createCart(Apttus_CPQApi.CPQ.CreateCartRequestDO request)



Parameters
NameTypeRequired?Description
requestApttus_CPQApi.CPQ.CreateCartRequestDOYesThe request data object.



Request Data Object - Apttus_CPQApi.CPQ.CreateCartRequestDO
FieldTypeDescription
PropertiesList<Apttus_CPQApi.CPQ.PropertyDO>The list of properties applicable to the cart
QuoteIDIDThe id of the quote/proposal to be associated with the cart.



Data Object - Apttus_CPQApi.CPQ.PropertyDO
FieldTypeDescription
NameStringSpecify the features applicable to the cart. Applicable values are:
  • useAdvancedApproval: Enables Advanced Approval for a cart.
  • useDealOptimizer: Enables Deal Optimizer for a cart
ValueStringThe applicable values are true or false. Specifying the value as true enables the feature for a cart.



Response Data Object - Apttus_CPQApi.CPQ.CreateCartResponseDO
FieldTypeDescription
CartIdIDThe ID of the newly created cart object


Code Sample

The sample below enables you to create a cart for a valid quote with a Quote ID. Using the sample below, you can search for a valid quote using a quote number. If a quote exists with the quote number entered, you can create a cart using the createCart API or you will be prompted with a message to enter a valid quote number. You can invoke this API in use cases when you want to show a cart page based on the quote. For example for a realized opportunity, you can create a quote. Based on a valid quote ID, you can create a cart using this API.
 

/**
 * The below method demonstrates how to create a cart for a quote
 */
public static void createCart(String quoteNumber) 
{
	
	List<Apttus_Proposal__Proposal__c> quote = [SELECT Id FROM Apttus_Proposal__Proposal__c WHERE Name = :quoteNumber LIMIT 1];
	
	if(!quote.isEmpty()) 
	{
		
		// Create the request object
		Apttus_CPQApi.CPQ.CreateCartRequestDO request = new Apttus_CPQApi.CPQ.CreateCartRequestDO();
		List<Apttus_Config2.Property> Properties = new List<Apttus_Config2.Property>();
		Properties.add(new Apttus_Config2.Property(‘useAdvancedApproval’,’false’));
		Properties.add(new Apttus_Config2.Property(‘isCartVersioningDisabled,’true’));

		request.QuoteId = quote.get(0).Id;
		request.Properties = Properties;
		// Excute the createCart routine
		Apttus_CPQApi.CPQ.CreateCartResponseDO response = Apttus_CPQApi.CPQWebService.createCart(request);		
		System.debug('Cart has been successfully created. CartId = ' + response.CartId);
	}
}
CODE


Integration Details

Use the following information in your integrations with CPQ Web Services API. Refer to Integrating Conga with External Systems for information on how to get started.

API Prerequisites

None.

Response/Request XML

Example Request

<soapenv:Envelope
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:cpq="http://soap.sforce.com/schemas/class/Apttus_CPQApi/CPQWebService"
    xmlns:cpq1="http://soap.sforce.com/schemas/class/Apttus_CPQApi/CPQ">
    <soapenv:Header>
        <cpq:SessionHeader>
            <cpq:sessionId>00D4P000000z7dE!AQQAQLOWqt9rvkoE67lP.NXIamuJl0mjoOR6a_l0vkPoATAH.gKFFRWManncKXN0KGY92akqlxsMOzeOlRfErg4V2LtI03XQ</cpq:sessionId>
        </cpq:SessionHeader>
    </soapenv:Header>
    <soapenv:Body>
        <cpq:createCart>
            <cpq:request>
                <cpq1:QuoteId>a0c4P00000GKQzL</cpq1:QuoteId>
            </cpq:request>
        </cpq: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_CPQApi/CPQWebService"
    xmlns:CreateCartResponseDO="http://soap.sforce.com/schemas/class/Apttus_CPQApi/CPQ">
    <soapenv:Body>
        <createCartResponse>
            <result>
                <CreateCartResponseDO:CartId>a1OZ0000002YK9rMAG</CreateCartResponseDO:CartId>
            </result>
        </createCartResponse>
    </soapenv:Body>
</soapenv:Envelope>
XML