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

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



Parameters
NameTypeDescription
requestApttus_CPQApi.CPQ.AddBundleRequestDOThe id of the agreement



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



Data Object - Apttus_CPQApi.CPQ.SelectedBundleDO
FieldTypeDescription
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
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.



Data Object - Apttus_CPQApi.CPQ.SelectedOptionDO
FieldTypeDescription
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
FieldTypeDescription
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);
		if(productOptionGroupResult.HasOptionGroups) 
		{
			// Add the option products to the request
			request.SelectedBundle.SelectedOptions = new List<Apttus_CPQApi.CPQ.SelectedOptionDO>();
			for(Apttus_CPQApi.CPQ.ProductOptionGroupDO productOptionGroup : productOptionGroupResult.OptionGroups) 
			{
				if(productOptionGroup.HasOptionComponents) 
				{
					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;
						request.SelectedBundle.SelectedOptions.add(selectedOptionDO);
					}
				}
			}
		}
		
		// Execute the addBundle routine
		Apttus_CPQApi.CPQ.AddBundleResponseDO response = Apttus_CPQApi.CPQWebService.addBundle(request);
			
		System.debug('Line Number of added bundle = ' + response.LineNumber);
	}
}
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

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>00DZ000000NAEIA!ASAAQFRdZcUFQ8LrHGF_qYNN9deP0ee.07JRqgeS3IF8IIlzILBdAOPySGSkif1VBtALP6pryVNOXfhn0faHOpGsc9GFVLl0</cpq:sessionId>
        </cpq:SessionHeader>
    </soapenv:Header>
    <soapenv:Body>
        <cpq:addBundle>
            <cpq:request>
                <cpq1:CartId>a1OZ0000002YdIH</cpq1:CartId>
                <cpq1:SelectedBundle>
                    <cpq1:SelectedProduct>
                        <cpq1:ProductId>01tZ0000004lUXt</cpq1:ProductId>
                        <cpq1:Quantity>1</cpq1:Quantity>
                        <cpq1:SellingTerm>1</cpq1:SellingTerm>
                        <cpq1:StartDate>2020-05-14</cpq1:StartDate>
                        <cpq1:EndDate>2020-05-15</cpq1:EndDate>
                        <cpq1:Comments>None</cpq1:Comments>
                    </cpq1:SelectedProduct>
                    <cpq1:SelectedOptions>
                        <cpq1:ComponentId>a1YZ0000002jPuS</cpq1:ComponentId>
                        <cpq1:ComponentProductId>01tZ0000004u2io</cpq1:ComponentProductId>
                        <cpq1:Quantity>1</cpq1:Quantity>
                        <cpq1:SellingTerm>1</cpq1:SellingTerm>
                        <cpq1:StartDate>2020-05-14</cpq1:StartDate>
                        <cpq1:EndDate>2020-05-15</cpq1:EndDate>
                        <cpq1:Comments>none</cpq1:Comments>
                    </cpq1:SelectedOptions>
                </cpq1:SelectedBundle>
            </cpq:request>
        </cpq:addBundle>
    </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:AddBundleResponseDO="http://soap.sforce.com/schemas/class/Apttus_CPQApi/CPQ">
    <soapenv:Body>
        <addBundleResponse>
            <result>
                <AddBundleResponseDO:LineNumber>8</AddBundleResponseDO:LineNumber>
            </result>
        </addBundleResponse>
    </soapenv:Body>
</soapenv:Envelope>
XML