This API adds one or more products (with default options) to the cart along with quantity, term, start date, and end date.


APISignature
addMultiProductswebService static Apttus_CPQApi.CPQ.AddMultiProductResponseDO addMultiProducts(Apttus_CPQApi.CPQ.AddMultiProductRequestDO request)



Parameters
NameTypeDescription
requestApttus_CPQApi.CPQ.AddMultiProduct RequestDOThe request data object.



Request Data Object - Apttus_CPQApi.CPQ.AddMultiProductRequestDO
FieldTypeDescription
CartIdIDThe Id of the cart.
SelectedProductsList <Apttus_CPQApi.CPQ.SelectedProductDO>The list of selected product data objects.
Data Object - Apttus_CPQApi.CPQ.SelectedProductDO
FieldTypeDescription
AttributeValuesListList of attributes values.
CommentsStringComments associated with the record.
CopyBundleConfigurationFromSourceBooleanYou can use this to copy the configuration of the bundle from the source
CustomDataApttus_Config2__LineItem__cThis can be used to include the list of custom fields you have added to the product.
CustomFields

List<String> CustomFields

List of custom fields created for your product.
EndDateDateThe end date.
ProductIdIDId of the product bundle.
QuantityDecimalThe bundle quantity.
RelatedLineItemsListList of related line items for bundle
SellingTermDecimalThe bundle selling term.
SourceFieldsListList of the fields in the source bundle that you want to copy.
SourceIdIDID of the source bundle.
StartDateDateThe start date. You should ensure you use the correct date format.



Response Data Object - Apttus_CPQApi.CPQ.AddMultiProductResponseDO
FieldTypeDescription
LineNumbersList<Decimal>The list of line numbers added to the cart.


Code Sample

The sample below enables you to add multiple selected products with a specific product ID and its associated quantity, validity and selling term to a specific cart with a specific cartID. For example, if the user has selected software and hardware products, the products are added to the cart, on click of Add to Cart. The user is navigated to the cart page where they can view and change the quantity, selling term and other editable aspects of the product.
 

/**
 * The below method demonstrates how to add multiple products to an existing cart (every quote has a cart)
 * Lets assume the Quote's Cart is blank and the standalone/bundle products are Laptop, Monitor, Wifi Router
 * The input of this method is Quote Number and the Ids of the Laptop bundle product, Monitor and Wifi Router standalone products
 */
public static void addMultipleProducts(String quoteNumber, List<ID> productIds) 
{
	
	List<Apttus_Config2__ProductConfiguration__c> cart = [SELECT Id FROM Apttus_Config2__ProductConfiguration__c WHERE Apttus_QPConfig__Proposald__r.Name = :quoteNumber LIMIT 1];
	
	if(!cart.isEmpty() && productIds != null && !productIds.isEmpty()) 
	{
		
		// Assume the quantity and selling term for the product is 1
		Integer quantity = 1;
		Integer sellingTerm = 1;
		
		// Create the request object
		Apttus_CPQApi.CPQ.AddMultiProductRequestDO request = new Apttus_CPQApi.CPQ.AddMultiProductRequestDO();
		request.CartId = cart.get(0).Id;
		
		// Add the products to the request
		for(ID productId : productIds) 
		{
			Apttus_CPQApi.CPQ.SelectedProductDO selectedProduct = new Apttus_CPQApi.CPQ.SelectedProductDO();
			selectedProduct.ProductId = productId;
			selectedProduct.Quantity = quantity;
			selectedProduct.SellingTerm = sellingTerm;
			request.SelectedProducts.add(selectedProduct);
		}
		
		// Execute the addMultiProducts routine
		Apttus_CPQApi.CPQ.AddMultiProductResponseDO response = Apttus_CPQApi.CPQWebService.addMultiProducts(request);
		
		System.debug('Line Numbers of added products = ' + response.LineNumbers);
	}
}
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

Request/Response 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>00DZ000000NAEIA!ASAAQHmIRqgn4R9Oi1yQjWTIVk4UZmsDe_.eK0Z9z6qLij7Tu.L_Yo8dRA_p8OmhKMeRs4uzCZTadIgQ9fEbDKciXEQYRyaA</cpq:sessionId>
        </cpq:SessionHeader>
    </soapenv:Header>
    <soapenv:Body>
        <cpq:addMultiProducts>
            <cpq:request>
                <cpq1:CartId>a1OZ0000002YtUs</cpq1:CartId>
                <cpq1:SelectedProducts>
                    <cpq1:Comments>Some comment</cpq1:Comments>
                    <cpq1:ProductId>01tZ0000004lUXU</cpq1:ProductId>
                    <cpq1:EndDate>2020-06-30</cpq1:EndDate>
                    <cpq1:Quantity>5</cpq1:Quantity>
                    <cpq1:SellingTerm>1</cpq1:SellingTerm>
                    <cpq1:StartDate>2020-05-28</cpq1:StartDate>
                </cpq1:SelectedProducts>
                <cpq1:SelectedProducts>
                    <cpq1:Comments>some comment</cpq1:Comments>
                    <cpq1:ProductId>01tZ0000004lUXt</cpq1:ProductId>
                    <cpq1:EndDate>2020-06-30</cpq1:EndDate>
                    <cpq1:Quantity>1</cpq1:Quantity>
                    <cpq1:SellingTerm>1</cpq1:SellingTerm>
                    <cpq1:StartDate>2020-05-28</cpq1:StartDate>
                </cpq1:SelectedProducts>
                <cpq1:SelectedProducts>
                    <cpq1:Comments>Some comment</cpq1:Comments>
                    <cpq1:ProductId>01tZ0000004lUYI</cpq1:ProductId>
                    <cpq1:EndDate>2020-06-30</cpq1:EndDate>
                    <cpq1:Quantity>2</cpq1:Quantity>
                    <cpq1:SellingTerm>5</cpq1:SellingTerm>
                    <cpq1:StartDate>2020-05-28</cpq1:StartDate>
                </cpq1:SelectedProducts>
            </cpq:request>
        </cpq:addMultiProducts>
    </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:AddMultiProductResponseDO="http://soap.sforce.com/schemas/class/Apttus_CPQApi/CPQ">
    <soapenv:Body>
        <addMultiProductsResponse>
            <result>
                <AddMultiProductResponseDO:LineNumbers>1</AddMultiProductResponseDO:LineNumbers>
                <AddMultiProductResponseDO:LineNumbers>2</AddMultiProductResponseDO:LineNumbers>
                <AddMultiProductResponseDO:LineNumbers>3</AddMultiProductResponseDO:LineNumbers>
            </result>
        </addMultiProductsResponse>
    </soapenv:Body>
</soapenv:Envelope>
XML