This retrieves option groups, options, and list prices for a price list product.


APISignature
getOptionGroupsForPriceListProductwebService static Apttus_CPQApi.CPQ.ProductOptionGroupSearchResultDO getOptionGroupsForPriceListProduct(Id priceListId, Id productId)



Parameters
NameTypeDescription
pricelistIdIDThe Id of the price list.
productIdIDThe Id of the product bundle.



Response Data Object - Apttus_CPQApi.CPQ.ProductOptionGroupSearchResultDO
NameTypeDescription
HasOptionGroupsBooleanIndicates if the bundle has option groups.
OptionGroupsList<Apttus_CPQApi.CPQ.ProductOptionGroupDO>The list of product option group data objects.



Data Object - Apttus_CPQApi.CPQ.ProductOptionGroupDO
FieldTypeDescription
ChildOptionGroupsList<Apttus_CPQApi.CPQ.ProductOptionGroupDO>List of child option group data objects.
HasChildOptionGroupsBooleanIndicates whether there are child option groups.
HasOptionComponentsBooleanIndicates if the option group has product components.
LabelStringThe option group label.
MaxOptionsIntegerMaximum number of options that can be selected from the group.
MinOptionsIntegerMinimum number of options that must be selected from the group.
NameStringThe option group name.
OptionComponentsList<Apttus_CPQApi.CPQ.ProductOptionComponentDO>List of product component data objects.
ParentOptiongroupIdIDId of the parent option group.
ProductOptionGroupIdIDId of the product option group.



Data Object - Apttus_CPQApi.CPQ.ProductOptionComponentDO
FieldTypeDescription
ComponentIdIDId of the component.
ComponentProductIdIDId of the component product.
DescriptionStringThe product description.
HasPricesBooleanIndicates if there are list prices for the product.
ImageUrlStringThe location of the image, if there is one, associated with the product.
IsDefaultBooleanIndicates if the option is included by default for the bundle.
IsRequiredBooleanIndicates if the option is mandatory for the bundle.
NameStringThe product name.
PricesList<Apttus_CPQApi.CPQ.PriceDO>List of price data objects.
ProductCodeStringThe product code.



Data Object - Apttus_CPQApi.CPQ.PriceDO
FieldTypeDescription
ChargeTypeStringThe charge type.
 PriceItemApttus_Config2__PriceListItem__c objectThe price list items for a price list.
ValueDecimalThe list price.


Code Sample

Using the sample below you enable the user to search and select products by a price list. You can then pass the IDs of the price list and product as arguments to the API. If in the result object HasOptionGroups returns true, fetch and display the option group components. If the option group components HasComponents=true display the option components such as quantity. For example if the user searches a product and clicks Search, invoke the API to fetch the option groups for that bundle.

public void getOptionGroupsForPriceListProduct()
{
	string productID='';
	//Fetch product ID of selected products
	for(ProductWrapperClass selProdWrap: lstProductwrap) 
	{
		if(selProdWrap.selected)
		{
			productID=selProdWrap.ProductId;
			break;
		}
	}
	
	//If no product is selected, show an appropriate error message
	if(productID=='')
	{
		ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.info, 'Please select at least one Product.')); 
					
		lstOptionGroup = new List<Apttus_CPQApi.CPQ.ProductOptionGroupDO>();
		lstProductOptionWrapper = new List<ProductOptionWrapperClass>();   
	}
	//If product is selected, pass pricelistID and productID as parameters to the API
	else
	{
		Apttus_CPQApi.CPQ.ProductOptionGroupSearchResultDO result = Apttus_CPQApi.CPQWebService.getOptionGroupsForPriceListProduct(priceListId, productID); 
		lstOptionGroup = new List<Apttus_CPQApi.CPQ.ProductOptionGroupDO>();
		lstProductOptionWrapper = new List<ProductOptionWrapperClass>();
		
		//If the product has option groups, i,e the flag HasOptionGroups returns true run the loop below fetching the components.	
		if(result.HasOptionGroups)
		{
			//For an option group fetch and display the following components
			For(Apttus_CPQApi.CPQ.ProductOptionGroupDO optionResult : result.OptionGroups)
			{
				ProductOptionWrapperClass objProductOptionWrapperClass=new ProductOptionWrapperClass();
				objProductOptionWrapperClass.ProductOptionGroupId=optionResult.ProductOptionGroupId;
				objProductOptionWrapperClass.Name=optionResult.Name;
				objProductOptionWrapperClass.Label=optionResult.Label;
				objProductOptionWrapperClass.ParentOptiongroupId=optionResult.ParentOptiongroupId;
				objProductOptionWrapperClass.MinOptions=optionResult.MinOptions;
				objProductOptionWrapperClass.MaxOptions=optionResult.MaxOptions;
				objProductOptionWrapperClass.HasChildOptionGroups=optionResult.HasChildOptionGroups;
				objProductOptionWrapperClass.ChildOptionGroups=optionResult.ChildOptionGroups;
				List<ProductQuantityOptionWrapperClass> listOptionComponent= new List<ProductQuantityOptionWrapperClass>();

				//For an option group with components such as min, max and quantity fetch and display the editable components to the user				
				for(Apttus_CPQApi.CPQ.ProductOptionComponentDO optionComponent : optionResult.OptionComponents)
				{
					ProductQuantityOptionWrapperClass objProductQuantityOptionWrapperClass = new ProductQuantityOptionWrapperClass ();
					objProductQuantityOptionWrapperClass.OptionComponent = optionComponent;                        
					objProductQuantityOptionWrapperClass.Quantity = 1;

					//Fetch and display the list price of the option components					
					List<Apttus_CPQApi.CPQ.PriceDO> priceList = new List<Apttus_CPQApi.CPQ.PriceDO>();
					for(Apttus_CPQApi.CPQ.PriceDO price :  optionComponent.Prices)
					{                            
						priceList.Add(price);
					}
					objProductQuantityOptionWrapperClass.prices = priceList ;
					listOptionComponent.Add(objProductQuantityOptionWrapperClass);
				}
				objProductOptionWrapperClass.OptionComponents = listOptionComponent;
				lstOptionGroup.Add(optionResult);
				lstProductOptionWrapper.Add(objProductOptionWrapperClass);
			}
			
			ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.info, 'Option Count: ' + lstProductOptionWrapper.size()));
		}
	}
}
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.

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">
   <soapenv:Header>
      <cpq:SessionHeader>
         <cpq:sessionId>00D4P000000z7dE!AQQAQLOWqt9rvkoE67lP.NXIamuJl0mjoOR6a_l0vkPoATAH.gKFFRWManncKXN0KGY92akqlxsMOzeOlRfErg4V2LtI03XQ</cpq:sessionId>
      </cpq:SessionHeader>
   </soapenv:Header>
   <soapenv:Body>
      <cpq:getOptionGroupsForPriceListProduct>
         <cpq:priceListId>a1a4P00000D3AVG</cpq:priceListId>
         <cpq:productId>01t4P000008OfJ8</cpq:productId>
      </cpq:getOptionGroupsForPriceListProduct>
   </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:ProductOptionGroupSearchResultDO="http://soap.sforce.com/schemas/class/Apttus_CPQApi/CPQ"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
        <getOptionGroupsForPriceListProductResponse>
            <result>
                <ProductOptionGroupSearchResultDO:HasOptionGroups>true</ProductOptionGroupSearchResultDO:HasOptionGroups>
                <ProductOptionGroupSearchResultDO:OptionGroups>
                    <ProductOptionGroupSearchResultDO:HasChildOptionGroups>false</ProductOptionGroupSearchResultDO:HasChildOptionGroups>
                    <ProductOptionGroupSearchResultDO:HasOptionComponents>true</ProductOptionGroupSearchResultDO:HasOptionComponents>
                    <ProductOptionGroupSearchResultDO:Label>Enclosure & Rack</ProductOptionGroupSearchResultDO:Label>
                    <ProductOptionGroupSearchResultDO:MaxOptions>1</ProductOptionGroupSearchResultDO:MaxOptions>
                    <ProductOptionGroupSearchResultDO:MinOptions>1</ProductOptionGroupSearchResultDO:MinOptions>
                    <ProductOptionGroupSearchResultDO:Name>Enclosure & Rack</ProductOptionGroupSearchResultDO:Name>
                    <ProductOptionGroupSearchResultDO:OptionComponents>
                        <ProductOptionGroupSearchResultDO:ComponentId>a1z4P000009c5RaQAI</ProductOptionGroupSearchResultDO:ComponentId>
                        <ProductOptionGroupSearchResultDO:ComponentProductId>01t4P000008OfLWQA0</ProductOptionGroupSearchResultDO:ComponentProductId>
                        <ProductOptionGroupSearchResultDO:Description xsi:nil="true"/>
                        <ProductOptionGroupSearchResultDO:HasPrices>true</ProductOptionGroupSearchResultDO:HasPrices>
                        <ProductOptionGroupSearchResultDO:ImageUrl xsi:nil="true"/>
                        <ProductOptionGroupSearchResultDO:IsDefault>true</ProductOptionGroupSearchResultDO:IsDefault>
                        <ProductOptionGroupSearchResultDO:IsRequired>false</ProductOptionGroupSearchResultDO:IsRequired>
                        <ProductOptionGroupSearchResultDO:Name>c3000 Server Enclosure</ProductOptionGroupSearchResultDO:Name>
                        <ProductOptionGroupSearchResultDO:Prices>
                            <ProductOptionGroupSearchResultDO:ChargeType>Standard Price</ProductOptionGroupSearchResultDO:ChargeType>
                            <ProductOptionGroupSearchResultDO:PriceItem xsi:type="Apttus_Config2__PriceListItem__c">
                                <Id>a1Z4P00000EDIH4UAP</Id>
                                <Apttus_Config2__Active__c>true</Apttus_Config2__Active__c>
                                <Apttus_Config2__AllocateGroupAdjustment__c>true</Apttus_Config2__AllocateGroupAdjustment__c>
                                <Apttus_Config2__AllowManualAdjustment__c>true</Apttus_Config2__AllowManualAdjustment__c>
                                <Apttus_Config2__AllowProration__c>false</Apttus_Config2__AllowProration__c>
                                <Apttus_Config2__ChargeType__c>Standard Price</Apttus_Config2__ChargeType__c>
                                <Apttus_Config2__ListPrice__c>199.00000</Apttus_Config2__ListPrice__c>
                                <Apttus_Config2__PriceIncludedInBundle__c>false</Apttus_Config2__PriceIncludedInBundle__c>
                                <Apttus_Config2__PriceListId__c>a1a4P00000D3AVGQA3</Apttus_Config2__PriceListId__c>
                                <Apttus_Config2__PriceMethod__c>Per Unit</Apttus_Config2__PriceMethod__c>
                                <Apttus_Config2__PriceType__c>One Time</Apttus_Config2__PriceType__c>
                                <Apttus_Config2__PriceUom__c>Each</Apttus_Config2__PriceUom__c>
                                <Apttus_Config2__ProductId__c>01t4P000008OfLWQA0</Apttus_Config2__ProductId__c>
                                <Apttus_Config2__ProductId__r xsi:type="Product2">
                                    <Id>01t4P000008OfLWQA0</Id>
                                    <Family>Hardware</Family>
                                    <Name>c3000 Server Enclosure</Name>
                                    <ProductCode>HW-ER001</ProductCode>
                                </Apttus_Config2__ProductId__r>
                                <Name>PI-0000000435</Name>
                            </ProductOptionGroupSearchResultDO:PriceItem>
                            <ProductOptionGroupSearchResultDO:Value>199.00000</ProductOptionGroupSearchResultDO:Value>
                        </ProductOptionGroupSearchResultDO:Prices>
                        <ProductOptionGroupSearchResultDO:ProductCode>HW-ER001</ProductOptionGroupSearchResultDO:ProductCode>
                    </ProductOptionGroupSearchResultDO:OptionComponents>
                    <ProductOptionGroupSearchResultDO:OptionComponents>
                        <ProductOptionGroupSearchResultDO:ComponentId>a1z4P000009c5RbQAI</ProductOptionGroupSearchResultDO:ComponentId>
                        <ProductOptionGroupSearchResultDO:ComponentProductId>01t4P000008OfKTQA0</ProductOptionGroupSearchResultDO:ComponentProductId>
                        <ProductOptionGroupSearchResultDO:Description xsi:nil="true"/>
                        <ProductOptionGroupSearchResultDO:HasPrices>true</ProductOptionGroupSearchResultDO:HasPrices>
                        <ProductOptionGroupSearchResultDO:ImageUrl xsi:nil="true"/>
                        <ProductOptionGroupSearchResultDO:IsDefault>false</ProductOptionGroupSearchResultDO:IsDefault>
                        <ProductOptionGroupSearchResultDO:IsRequired>false</ProductOptionGroupSearchResultDO:IsRequired>
                        <ProductOptionGroupSearchResultDO:Name>c7000 Server Enclosure</ProductOptionGroupSearchResultDO:Name>
                        <ProductOptionGroupSearchResultDO:Prices>
                            <ProductOptionGroupSearchResultDO:ChargeType>Standard Price</ProductOptionGroupSearchResultDO:ChargeType>
                            <ProductOptionGroupSearchResultDO:PriceItem xsi:type="Apttus_Config2__PriceListItem__c">
                                <Id>a1Z4P00000EDIFqUAP</Id>
                                <Apttus_Config2__Active__c>true</Apttus_Config2__Active__c>
                                <Apttus_Config2__AllocateGroupAdjustment__c>true</Apttus_Config2__AllocateGroupAdjustment__c>
                                <Apttus_Config2__AllowManualAdjustment__c>true</Apttus_Config2__AllowManualAdjustment__c>
                                <Apttus_Config2__AllowProration__c>false</Apttus_Config2__AllowProration__c>
                                <Apttus_Config2__ChargeType__c>Standard Price</Apttus_Config2__ChargeType__c>
                                <Apttus_Config2__ListPrice__c>299.00000</Apttus_Config2__ListPrice__c>
                                <Apttus_Config2__PriceIncludedInBundle__c>false</Apttus_Config2__PriceIncludedInBundle__c>
                                <Apttus_Config2__PriceListId__c>a1a4P00000D3AVGQA3</Apttus_Config2__PriceListId__c>
                                <Apttus_Config2__PriceMethod__c>Per Unit</Apttus_Config2__PriceMethod__c>
                                <Apttus_Config2__PriceType__c>One Time</Apttus_Config2__PriceType__c>
                                <Apttus_Config2__PriceUom__c>Each</Apttus_Config2__PriceUom__c>
                                <Apttus_Config2__ProductId__c>01t4P000008OfKTQA0</Apttus_Config2__ProductId__c>
                                <Apttus_Config2__ProductId__r xsi:type="Product2">
                                    <Id>01t4P000008OfKTQA0</Id>
                                    <Family>Hardware</Family>
                                    <Name>c7000 Server Enclosure</Name>
                                    <ProductCode>HW-ER002</ProductCode>
                                </Apttus_Config2__ProductId__r>
                                <Name>PI-0000000358</Name>
                            </ProductOptionGroupSearchResultDO:PriceItem>
                            <ProductOptionGroupSearchResultDO:Value>299.00000</ProductOptionGroupSearchResultDO:Value>
                        </ProductOptionGroupSearchResultDO:Prices>
                        <ProductOptionGroupSearchResultDO:ProductCode>HW-ER002</ProductOptionGroupSearchResultDO:ProductCode>
                    </ProductOptionGroupSearchResultDO:OptionComponents>
                    <ProductOptionGroupSearchResultDO:ParentOptionGroupId xsi:nil="true"/>
                    <ProductOptionGroupSearchResultDO:ProductOptionGroupId>a154P000005liDzQAI</ProductOptionGroupSearchResultDO:ProductOptionGroupId>
                </ProductOptionGroupSearchResultDO:OptionGroups>
            </result>
        </getOptionGroupsForPriceListProductResponse>
    </soapenv:Body>
</soapenv:Envelope>
XML