Download PDF
Download page Retrieving Products and List Prices for a Price List and Category.
Retrieving Products and List Prices for a Price List and Category
This API is used to get the list of products and related list prices for a specified category in the price list. This API automatically takes into consideration product visibility rules and will enforce them if applicable. For more information, see Configuring Product Visibility.
API | Signature |
---|---|
getProductsForPriceListCategory | webService static Apttus_CPQApi.CPQ.ProductSearchResultDO getProductsForPriceListCategory(Id priceListId, Id categoryId) |
Parameters | ||
---|---|---|
Name | Type | Description |
priceListId | ID | The id of the price list. |
categoryID | ID | The id of the category. |
Response Data Object - Apttus_CPQApi.CPQ.ProductSearchResultDO | ||
---|---|---|
Field | Type | Description |
HasProducts | Boolean | This returns true if the list of product data objects is not empty. |
Products | List<Apttus_CPQApi.CPQ.ProductDO> | The list of product data objects. |
Data Object - Apttus_CPQApi.CPQ.ProductDO | ||
---|---|---|
Field | Type | Description |
ContentUrl | String | The product content location. |
Description | String | The product description. |
HasPrices | Boolean | Indicates if there are list prices for the product. |
HasProperties | Boolean | Indicates if there are properties set for the product. |
ImageUrl | String | The location of the image, if there is one, associated with the product. |
Name | String | The product name. |
Prices | List<Apttus_CPQApi.CPQ.PriceDO> | The list of price data objects. |
ProductCode | String | The product code. |
ProductId | ID | The Id of the product. |
Property | List<Apttus_CPQApi.CPQ.PropertyDO> | The list of property data objects. |
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. |
Data Object - Apttus_CPQApi.CPQ.PropertyDO | ||
---|---|---|
Field | Type | Description |
Name | String | The name of the property. |
Value | Decimal | The value of a property. |
Code Sample
The sample below enables you to search for categories using price list name. Once the user selects the category and proceeds to search, pass the pricelistID and categoryID as parameters to the API. The user can select and view the products associated with that category and it components. For example, user enters the price list name and selects the category-Hardware. All the products associated with the Hardware category, such as Laptop are displayed. You can display all the fields associated to that product.
public void getProductList()
{
categoryId ='';
for(CategoryWrapperClass wrap: lstwrap )
{
if(wrap.selected == true)
{
categoryId = categoryId + wrap.CategoryId +',';
}
}
//If no category is selected prompt the user with an appropriate error message.
if(categoryId.Trim()=='')
{
ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.info, 'Please select at least one Category.'));
lstProductwrap = New List<ProductWrapperClass>();
lstProductwrapAll = New List<ProductWrapperClass>();
}
//Pass the pricelistID and categoryID as parameters to the API
else
{
Apttus_CPQApi.CPQ.ProductSearchResultDO productResult = Apttus_CPQApi.CPQWebService.getProductsForPriceListCategory(priceListId,categoryId.Substring(0,categoryId.length()-1));
productCount = 'Product Count: ' + productResult.Products.size();
lstProductwrap = New List<ProductWrapperClass>();
lstProductwrapAll = New List<ProductWrapperClass>();
For(Apttus_CPQApi.CPQ.ProductDO catresult : productResult.Products)
//Fetch and display the following product fields to the user
{
ProductWrapperClass wrap = New ProductWrapperClass ();
wrap.ProductId = catresult.ProductId;
wrap.ProductCode= catresult.ProductCode;
wrap.ProductName=catresult.Name;
wrap.Description=catresult.Description;
wrap.ImageUrl=catresult.ImageUrl;
wrap.ContentUrl=catresult.ContentUrl;
wrap.HasPrices=catresult.HasPrices;
wrap.Prices=catresult.Prices;
wrap.Quantity=1;
lstProductwrapAll.add(wrap);
}
}
}
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>00DZ000000NAEIA!ASAAQN7k3xhhvMe.j.8gpR.ijcGq77HJeF4MEDfbxbBAqZ8r4WWNTv3OVb6o1bjtHJLbq5mvHcuAH_ie6sTC3DzrWgnLdUuD</cpq:sessionId>
</cpq:SessionHeader>
</soapenv:Header>
<soapenv:Body>
<cpq:getProductsForPriceListCategory>
<cpq:priceListId>a1DZ0000002mg5n</cpq:priceListId>
<cpq:categoryId>a0nZ0000003x6pL</cpq:categoryId>
</cpq:getProductsForPriceListCategory>
</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:ProductSearchResultDO="http://soap.sforce.com/schemas/class/Apttus_CPQApi/CPQ"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<getProductsForPriceListCategoryResponse>
<result>
<ProductSearchResultDO:HasProducts>true</ProductSearchResultDO:HasProducts>
<ProductSearchResultDO:Products>
<ProductSearchResultDO:ContentUrl xsi:nil="true"/>
<ProductSearchResultDO:Description xsi:nil="true"/>
<ProductSearchResultDO:HasPrices>true</ProductSearchResultDO:HasPrices>
<ProductSearchResultDO:HasProperties>false</ProductSearchResultDO:HasProperties>
<ProductSearchResultDO:ImageUrl xsi:nil="true"/>
<ProductSearchResultDO:Name>Auto_API_BundleProduct1</ProductSearchResultDO:Name>
<ProductSearchResultDO:Prices>
<ProductSearchResultDO:ChargeType>Standard Price</ProductSearchResultDO:ChargeType>
<ProductSearchResultDO:PriceItem xsi:type="Apttus_Config2__PriceListItem__c">
<Id>a1CZ000000KOraoMAD</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>10.00000</Apttus_Config2__ListPrice__c>
<Apttus_Config2__PriceIncludedInBundle__c>false</Apttus_Config2__PriceIncludedInBundle__c>
<Apttus_Config2__PriceListId__c>a1DZ0000002mg5nMAA</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__ProductId__c>01tZ0000004lUXtIAM</Apttus_Config2__ProductId__c>
<Apttus_Config2__ProductId__r xsi:type="Product2">
<Id>01tZ0000004lUXtIAM</Id>
<Name>Auto_API_BundleProduct1</Name>
</Apttus_Config2__ProductId__r>
<Name>PI-0000539885</Name>
</ProductSearchResultDO:PriceItem>
<ProductSearchResultDO:Value>10.00000</ProductSearchResultDO:Value>
</ProductSearchResultDO:Prices>
<ProductSearchResultDO:ProductCode xsi:nil="true"/>
<ProductSearchResultDO:ProductId>01tZ0000004lUXtIAM</ProductSearchResultDO:ProductId>
</ProductSearchResultDO:Products>
<ProductSearchResultDO:Products>
<ProductSearchResultDO:ContentUrl xsi:nil="true"/>
<ProductSearchResultDO:Description xsi:nil="true"/>
<ProductSearchResultDO:HasPrices>true</ProductSearchResultDO:HasPrices>
<ProductSearchResultDO:HasProperties>false</ProductSearchResultDO:HasProperties>
<ProductSearchResultDO:ImageUrl xsi:nil="true"/>
<ProductSearchResultDO:Name>Auto_API_BundleProduct2</ProductSearchResultDO:Name>
<ProductSearchResultDO:Prices>
<ProductSearchResultDO:ChargeType>Standard Price</ProductSearchResultDO:ChargeType>
<ProductSearchResultDO:PriceItem xsi:type="Apttus_Config2__PriceListItem__c">
<Id>a1CZ000000KOrajMAD</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>10.00000</Apttus_Config2__ListPrice__c>
<Apttus_Config2__PriceIncludedInBundle__c>false</Apttus_Config2__PriceIncludedInBundle__c>
<Apttus_Config2__PriceListId__c>a1DZ0000002mg5nMAA</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__ProductId__c>01tZ0000004lUXyIAM</Apttus_Config2__ProductId__c>
<Apttus_Config2__ProductId__r xsi:type="Product2">
<Id>01tZ0000004lUXyIAM</Id>
<Name>Auto_API_BundleProduct2</Name>
</Apttus_Config2__ProductId__r>
<Name>PI-0000539884</Name>
</ProductSearchResultDO:PriceItem>
<ProductSearchResultDO:Value>10.00000</ProductSearchResultDO:Value>
</ProductSearchResultDO:Prices>
<ProductSearchResultDO:ProductCode xsi:nil="true"/>
<ProductSearchResultDO:ProductId>01tZ0000004lUXyIAM</ProductSearchResultDO:ProductId>
</ProductSearchResultDO:Products>
</result>
</getProductsForPriceListCategoryResponse>
</soapenv:Body>
</soapenv:Envelope>