Download PDF
Download page Retrieving Option Groups, Options, and List Prices for a Price List Product.
Retrieving Option Groups, Options, and List Prices for a Price List Product
This retrieves option groups, options, and list prices for a price list product.
API | Signature |
---|---|
getOptionGroupsForPriceListProduct | webService static Apttus_CPQApi.CPQ.ProductOptionGroupSearchResultDO getOptionGroupsForPriceListProduct(Id priceListId, Id productId) |
Parameters | ||
---|---|---|
Name | Type | Description |
pricelistId | ID | The Id of the price list. |
productId | ID | The Id of the product bundle. |
Response Data Object - Apttus_CPQApi.CPQ.ProductOptionGroupSearchResultDO | ||
---|---|---|
Name | Type | Description |
HasOptionGroups | Boolean | Indicates if the bundle has option groups. |
OptionGroups | List<Apttus_CPQApi.CPQ.ProductOptionGroupDO> | The list of product option group data objects. |
Data Object - Apttus_CPQApi.CPQ.ProductOptionGroupDO | ||
---|---|---|
Field | Type | Description |
ChildOptionGroups | List<Apttus_CPQApi.CPQ.ProductOptionGroupDO> | List of child option group data objects. |
HasChildOptionGroups | Boolean | Indicates whether there are child option groups. |
HasOptionComponents | Boolean | Indicates if the option group has product components. |
Label | String | The option group label. |
MaxOptions | Integer | Maximum number of options that can be selected from the group. |
MinOptions | Integer | Minimum number of options that must be selected from the group. |
Name | String | The option group name. |
OptionComponents | List<Apttus_CPQApi.CPQ.ProductOptionComponentDO> | List of product component data objects. |
ParentOptiongroupId | ID | Id of the parent option group. |
ProductOptionGroupId | ID | Id of the product option group. |
Data Object - Apttus_CPQApi.CPQ.ProductOptionComponentDO | ||
---|---|---|
Field | Type | Description |
ComponentId | ID | Id of the component. |
ComponentProductId | ID | Id of the component product. |
Description | String | The product description. |
HasPrices | Boolean | Indicates if there are list prices for the product. |
ImageUrl | String | The location of the image, if there is one, associated with the product. |
IsDefault | Boolean | Indicates if the option is included by default for the bundle. |
IsRequired | Boolean | Indicates if the option is mandatory for the bundle. |
Name | String | The product name. |
Prices | List<Apttus_CPQApi.CPQ.PriceDO> | List of price data objects. |
ProductCode | String | The product code. |
Data Object - Apttus_CPQApi.CPQ.PriceDO | ||
---|---|---|
Field | Type | Description |
ChargeType | String | The charge type. |
PriceItem | Apttus_Config2__PriceListItem__c object | The price list items for a price list. |
Value | Decimal | The 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()));
}
}
}
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>
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>