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

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

requestApttus_CPQApi.CPQ.AddMultiProduct RequestDOThe request data object.

Request Data Object - Apttus_CPQApi.CPQ.AddMultiProductRequestDO
CartIdIDThe Id of the cart.
SelectedProductsList <Apttus_CPQApi.CPQ.SelectedProductDO>The list of selected product data objects.
Data Object - Apttus_CPQApi.CPQ.SelectedProductDO
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.

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
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;
		// Execute the addMultiProducts routine
		Apttus_CPQApi.CPQ.AddMultiProductResponseDO response = Apttus_CPQApi.CPQWebService.addMultiProducts(request);
		System.debug('Line Numbers of added products = ' + response.LineNumbers);

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

                    <cpq1:Comments>Some comment</cpq1:Comments>
                    <cpq1:Comments>some comment</cpq1:Comments>
                    <cpq1:Comments>Some comment</cpq1:Comments>

Example Response