Data Object- Apttus_Config2.CPQAdminStruct.HierarchyDO
Name
Type
Description
ChildProductId
Id
The Id of child product.
ParentProductId
Id
The Id of the parent product.
Response Data Object- Apttus_Config2.CPQAdminStruct.HierarchyResponseDO
Name
Type
Description
Issuccess
Boolean
Indicates whether the product exists in the hierarchy or not.
Code Sample
The below sample code finds whether the child product is available in the hierarchy of its parent product.
public Boolean productExistsInHierarchy(String parentProductName, String childProductName)
{
Apttus_Config2.CPQAdminStruct.HierarchyDO hierDO = new Apttus_Config2.CPQAdminStruct.HierarchyDO();
Apttus_Config2.CPQAdminStruct.HierarchyRequestDO hierRequest = null;
Apttus_Config2.CPQAdminStruct.HierarchyResponseDO hierResponse = null;
// get child, parent products, and option group
Product2 parentProduct = [SELECT Id FROM Product2 WHERE Name = :parentProductName LIMIT 1];
Product2 childProduct = [SELECT Id FROM Product2 WHERE Name = :childProductName LIMIT 1];
hierRequest = new Apttus_Config2.CPQAdminStruct.HierarchyRequestDO();
hierDO = new Apttus_Config2.CPQAdminStruct.HierarchyDO();
hierDO.ParentProductId = parentProduct.Id;
hierDO.ChildProductId = childProduct.Id;
hierRequest.HierarchyDOs.add(hierDO);
hierResponse = Apttus_Config2.CPQAdminWebService.productExistsInHierarchy(hierRequest);
return hierResponse.Issuccess;
}