Download PDF
Download page Retrieving Products and List Prices for a Price List.
Retrieving Products and List Prices for a Price List
This API is used to get the list of all the products within the specified price list. This API automatically takes into consideration product visibility rules and will enforce them if applicable. For more information, see Configuring Product Visibility.
This API works only when you have associated a price list and price list items to a category. This API also considers the based on price list scenario.
API | Signature |
---|---|
getProductsForPriceList | webService static Apttus_CPQApi.CPQ.ProductSearchResultDO getProductsForPriceList(Id priceListId) |
Parameters | ||
---|---|---|
Name | Type | Description |
priceListId | ID | The id of 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
Using the sample you can show the user the list of products for a particular price list. For example if you have a price list created for a particular company, the user can search the price list by name and view all the products associated with that price list. For example, when a user searches for badger price list and clicks search, invoke the getProductsForPriceList API in which you pass the pricelistID as a parameter. Fetch and then display all the product components to the user such as Machinery, standard price, quantity and name and description of the product.
public void getProductsForPriceList()
{
//If the priceList name by which the user searches the price list exists fetch the ID.
if(priceListId == null || priceListId== '0')
{
List<Apttus_Config2__PriceList__c> priceListItemList = [select id from Apttus_Config2__PriceList__c where Name = :priceListName limit 1];
//If the priceListItem exists, the list size >0 assign the ID at the 0th position of the list to priceListId
if(priceListItemList.size() > 0)
{
priceListId = priceListItemList[0].ID;
}
else
{
lstProductwrapAll = New List<ProductWrapperClass>();
lstProductwrap = New List<ProductWrapperClass>();
return;
}
}
//Fetch id
Apttus_CPQApi.CPQ.ProductSearchResultDO productResult = Apttus_CPQApi.CPQWebService.getProductsForPriceList(priceListId);
productCount = 'Product Count: ' + productResult.Products.size();
lstProductwrapAll = New List<ProductWrapperClass>();
lstProductwrap = New List<ProductWrapperClass>();
//For the fetched pricelistID fetch and display the following
For(Apttus_CPQApi.CPQ.ProductDO catresult : productResult.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.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:getProductsForPriceList>
<cpq:priceListId>a1De0000001yPXQ</cpq:priceListId>
</cpq:getProductsForPriceList>
</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>
<getProductsForPriceListResponse>
<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>AutoQuoteBundle1</ProductSearchResultDO:Name>
<ProductSearchResultDO:Prices>
<ProductSearchResultDO:ChargeType>Standard Price</ProductSearchResultDO:ChargeType>
<ProductSearchResultDO:PriceItem xsi:type="Apttus_Config2__PriceListItem__c">
<Id>a1Ce0000003fQ1QEAU</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>01te0000005NGpDAAW</Apttus_Config2__ProductId__c>
<Apttus_Config2__ProductId__r xsi:type="Product2">
<Id>01te0000005NGpDAAW</Id>
<Name>AutoQuoteBundle1</Name>
</Apttus_Config2__ProductId__r>
<Name>PI-0000538767</Name>
</ProductSearchResultDO:PriceItem>
<ProductSearchResultDO:Value>100.00000</ProductSearchResultDO:Value>
</ProductSearchResultDO:Prices>
<ProductSearchResultDO:ProductCode xsi:nil="true"/>
<ProductSearchResultDO:ProductId>01te0000005NGpDAAW</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>AutoQuoteBundle2</ProductSearchResultDO:Name>
<ProductSearchResultDO:Prices>
<ProductSearchResultDO:ChargeType>Standard Price</ProductSearchResultDO:ChargeType>
<ProductSearchResultDO:PriceItem xsi:type="Apttus_Config2__PriceListItem__c">
<Id>a1Ce0000003fQ2EEAU</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>01te0000005NGpNAAW</Apttus_Config2__ProductId__c>
<Apttus_Config2__ProductId__r xsi:type="Product2">
<Id>01te0000005NGpNAAW</Id>
<Name>AutoQuoteBundle2</Name>
</Apttus_Config2__ProductId__r>
<Name>PI-0000538772</Name>
</ProductSearchResultDO:PriceItem>
<ProductSearchResultDO:Value>100.00000</ProductSearchResultDO:Value>
</ProductSearchResultDO:Prices>
<ProductSearchResultDO:ProductCode xsi:nil="true"/>
<ProductSearchResultDO:ProductId>01te0000005NGpNAAW</ProductSearchResultDO:ProductId>
</ProductSearchResultDO:Products>
</result>
</getProductsForPriceListResponse>
</soapenv:Body>
</soapenv:Envelope>