Retrieves List of Category IDs
You can use this API to retrieve the list of category Ids that are associated with the given product.
API |
Signature |
---|---|
getCategoryIds |
webService static List getCategoryIds(String productId) |
Request Parameter |
||
---|---|---|
Name |
Type |
Description |
productId | String |
The Id product for which you want to retrieve the category. |
Response Parameter |
||
---|---|---|
Name |
Type |
Description |
categoryIds | List |
The list of category Ids |
Code Sample
The below sample code retrieves the category associated with the given product.
public void getCategoryIDs(String productName) {
List<ID> categoryIds;
// retrieve the productSO
Product2 productSO = [SELECT Id, Name
FROM Product2
WHERE Name = :productName
LIMIT 1];
// retrieve associated category ids
categoryIds = Apttus_Config2.CPQAdminWebService.getCategoryIDs(productSO.Id);
retrun ategoryIds;
}