This adds a bundle along with selected products, options, and updated quantity to the cart.

addBundlewebService static Apttus_CPQApi.CPQ.AddBundleResponseDO addBundle(Apttus_CPQApi.CPQ.AddBundleRequestDO request)

requestApttus_CPQApi.CPQ.AddBundleRequestDOThe id of the agreement

Request Data Object - Apttus_CPQApi.CPQ.AddBundleRequestDO
CartIdIDThe Id of the cart.
SelectedBundleApttus_CPQApi.CPQ.SelectedBundleDOThe bundle to be added to the cart.

Data Object - Apttus_CPQApi.CPQ.SelectedBundleDO
SelectedOptionsList<Apttus_CPQApi.CPQ.SelectedOptionDO>The list of selected option data objects.
SelectedProductApttus_CPQApi.CPQ.SelectedProductDOThe selected product data object.

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.

Data Object - Apttus_CPQApi.CPQ.SelectedOptionDO
AttributeValuesListList of attributes values.
CommentsStringComments associated with the record.
ComponentIdIDId of the component.
ComponentProductIdIDId of the component product.
CustomDataApttus_Config2__LineItem__cThe values to be set for the custom fields in the CustomFields List
CustomFieldsList<String>List of Custom Field’s API Name
EndDateDateThe end date.
QuantityDecimalThe option quantity.
SellingTermDecimalThe option selling term.
SourceIdIDID of the source option.
StartDateDateThe start date. You should ensure you use the correct date format.

Response Data Object - Apttus_CPQApi.CPQ.AddBundleResponseDO
LineNumberDecimalThe bundle line number.

Code Sample

The sample below enables you to add a bundled product with a specific product ID and its associated quantity to a specific cart with a specific cartID. For example, a user selects a bundled product-Laptop+Mouse and clicks Add to Cart, the request to add bundle to the cart is invoked and the bundle with the specific product ID is added to a cart with the cart ID.

 * The below method demonstrates how to add a bundle product to an existing cart (every quote has a cart)
 * Lets assume the Quote's Cart is blank and Laptop is a bundle product and its two options are Keyboard and Mouse
 * The input of this method is Quote Number and the Id of the Laptop bundle product
 * Inside the method we will add the Laptop bundle product and also its two options Keyboard and Mouse to the cart
public static void addBundle(String quoteNumber, ID bundleProductId)
	List<Apttus_Config2__ProductConfiguration__c> cart = [SELECT Apttus_Config2__PriceListId__c,Id FROM Apttus_Config2__ProductConfiguration__c WHERE Apttus_QPConfig__Proposald__r.Name = :quoteNumber LIMIT 1];
	if(!cart.isEmpty() && bundleProductId != null) 
		// Assume the quantity and selling term for the bundle product and its options is 1
		Integer quantity = 1;
		Integer sellingTerm = 1;
		// Create the request object
		Apttus_CPQApi.CPQ.AddBundleRequestDO request = new Apttus_CPQApi.CPQ.AddBundleRequestDO();
		request.CartId = cart.get(0).Id;
		// Add the bundle product to the request
		request.SelectedBundle = new Apttus_CPQApi.CPQ.SelectedBundleDO();
		request.SelectedBundle.SelectedProduct = new Apttus_CPQApi.CPQ.SelectedProductDO();
		request.SelectedBundle.SelectedProduct.ProductId = bundleProductId;
		request.SelectedBundle.SelectedProduct.Quantity = quantity;
		request.SelectedBundle.SelectedProduct.SellingTerm = sellingTerm;
		// Get all the options of the bundle product
		Apttus_CPQApi.CPQ.ProductOptionGroupSearchResultDO productOptionGroupResult = Apttus_CPQApi.CPQWebService.getOptionGroupsForPriceListProduct(cart.get(0).Apttus_Config2__PriceListId__c, bundleProductId);
			// Add the option products to the request
			request.SelectedBundle.SelectedOptions = new List<Apttus_CPQApi.CPQ.SelectedOptionDO>();
			for(Apttus_CPQApi.CPQ.ProductOptionGroupDO productOptionGroup : productOptionGroupResult.OptionGroups) 
					for(Apttus_CPQApi.CPQ.ProductOptionComponentDO productOptionComponent : productOptionGroup.OptionComponents) 
						Apttus_CPQApi.CPQ.SelectedOptionDO selectedOptionDO = new Apttus_CPQApi.CPQ.SelectedOptionDO();
						selectedOptionDO.ComponentId = productOptionComponent.ComponentId;
						selectedOptionDO.ComponentProductId = productOptionComponent.ComponentProductId;
						selectedOptionDO.Quantity = quantity;
						selectedOptionDO.SellingTerm = sellingTerm;
		// Execute the addBundle routine
		Apttus_CPQApi.CPQ.AddBundleResponseDO response = Apttus_CPQApi.CPQWebService.addBundle(request);
		System.debug('Line Number of added bundle = ' + response.LineNumber);

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

Response/Request XML

Example Request


Example Response