Download PDF
Download page Retrieving Products and List Prices For a Price List Category and Search Text.
Retrieving Products and List Prices For a Price List Category and Search Text
This API is used to get the list of products that match search text criteria you used and belong to the specified category id 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 |
---|---|
getProductsForCategorySearchText | webService static Apttus_CPQApi.CPQ.ProductSearchResultDO getProductsForCategorySearchText(Id priceListId, Id categoryId, String searchText) |
Parameters | ||
---|---|---|
Name | Type | Description |
priceListId | ID | The id of the price list. |
categoryId | ID | The id of the category. |
searchText | String | The search terms that will be used to retrieve the products for the price list. |
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 user can enter the name of price list to view all the categories belonging to that price list. The sample below defines the behavior when the user selects a category and searches a product from the categories displayed. Fetch and pass the priceListID, categoryID, and productID as parameters to the API and display the fields of CPQ.ProductDo object. For example, the user enters a valid price list name, all the subsequent categories for the pricelist are displayed. The user selects the category Hardware and searches for a product Laptop. All the products matching the search string laptop are displayed along with the fields such as price, name , id and so on. You can execute the count loop to specify the number of products to be displayed per page and to provide next and previous pages.
public void getProductsForCategorySearchText()
{
//Search for single category multiple category using comma separator and fetch category id
categoryId ='';
for(CategoryWrapperClass wrap: lstwrap )
{
if(wrap.selected == true)
{
categoryId = categoryId + wrap.CategoryId +',';
}
}
//If no category selected is selected by the user, show the following 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>();
}
//If searched price list is valid, categories for that pricelist are displayed and if the user selects a category and enters search text by 'productName' parameter, pass the PricelistID, categoryID, and productID as parameters.
else
{
Apttus_CPQApi.CPQ.ProductSearchResultDO productResult = Apttus_CPQApi.CPQWebService.getProductsForCategorySearchText(priceListId,categoryId.Substring(0,categoryId.length()-1),productName);
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 components for the products
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.Quantity=1;
wrap.Prices=catresult.Prices;
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>00D4P000000z7dE!AQQAQGL6XYy.QsjqQQ6RTBnh.1ApTbiqkGAdVz9BS70lxobcyXgHHplmGXAe7p_cf6ziWJ8tpQt_4Q4Bi2VtYeMyzjhaPbf0</cpq:sessionId>
</cpq:SessionHeader>
</soapenv:Header>
<soapenv:Body>
<cpq:getProductsForCategorySearchText>
<cpq:priceListId>a1a4P00000D3AVG</cpq:priceListId>
<cpq:categoryId>a0nZ0000003x6pL</cpq:categoryId>
<cpq:searchText>server</cpq:searchText>
</cpq:getProductsForCategorySearchText>
</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>
<getProductsForCategorySearchTextResponse>
<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>AutoQuoteStandalone1</ProductSearchResultDO:Name>
<ProductSearchResultDO:Prices>
<ProductSearchResultDO:ChargeType>Standard Price</ProductSearchResultDO:ChargeType>
<ProductSearchResultDO:PriceItem xsi:type="Apttus_Config2__PriceListItem__c">
<Id>a1Ce0000003fQ0XEAU</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>100.00000</Apttus_Config2__ListPrice__c>
<Apttus_Config2__PriceIncludedInBundle__c>false</Apttus_Config2__PriceIncludedInBundle__c>
<Apttus_Config2__PriceListId__c>a1De0000001yPXQEA2</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>01te0000005NGoUAAW</Apttus_Config2__ProductId__c>
<Apttus_Config2__ProductId__r xsi:type="Product2">
<Id>01te0000005NGoUAAW</Id>
<Name>AutoQuoteStandalone1</Name>
</Apttus_Config2__ProductId__r>
<Name>PI-0000538756</Name>
</ProductSearchResultDO:PriceItem>
<ProductSearchResultDO:Value>100.00000</ProductSearchResultDO:Value>
</ProductSearchResultDO:Prices>
<ProductSearchResultDO:ProductCode xsi:nil="true"/>
<ProductSearchResultDO:ProductId>01te0000005NGoUAAW</ProductSearchResultDO:ProductId>
</ProductSearchResultDO:Products>
</result>
</getProductsForCategorySearchTextResponse>
</soapenv:Body>
</soapenv:Envelope>