Retrieving Options in an Option Group
You can use this API to retrieve the list of options associated with a given option group.
API |
Signature |
---|---|
getChildOptions |
webService static Apttus_Config2.CPQAdminStruct.HierarchyResponseDO getChildOptions(Apttus_Config2.CPQAdminStruct.HierarchyRequestDO hierarchyRequestDO) |
Request Parameter |
||
---|---|---|
Name |
Type |
Description |
hierarchyRequestDO | Apttus_Config2.CPQAdminStruct.HierarchyRequestDO |
The category request data object. |
Request Parameter - Apttus_Config2.CPQAdminStruct.HierarchyRequestDO |
||
---|---|---|
Name |
Type |
Description |
HierarchyDOs | List<Apttus_Config2.CPQAdminStruct.HierarchyDO> |
The list of hierarchy data object |
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 |
ProductStructureJSONs | List<Apttus_Config2.CPQAdminStruct.MapDO> |
The list of map, where the key is the option group Id and value is the JSON string of the product |
Response Data Object - Apttus_Config2.CPQAdminStruct.MapDO |
||
---|---|---|
Field |
Type |
Description |
String | Key |
The option group ID |
String | Value |
The value refers to the JSON String of the product. |
Code Sample
The below sample code returns the list of options for the given product and the option group.
public Apttus_Config2.CPQAdminStruct.HierarchyResponseDO getChildOptions(String productName, String optionGroupName)
{
Apttus_Config2.CPQAdminStruct.HierarchyDO hierDO = new Apttus_Config2.CPQAdminStruct.HierarchyDO();
Apttus_Config2.CPQAdminStruct.HierarchyRequestDO hierRequest = new Apttus_Config2.CPQAdminStruct.HierarchyRequestDO();
Apttus_Config2.CPQAdminStruct.HierarchyResponseDO hierResponse = null;
// get product and option group
Product2 prod = [SELECT Id FROM Product2 WHERE Name = :productName LIMIT 1];
Apttus_Config2__ClassificationHierarchy__c optionGroup = [SELECT Id FROM Apttus_Config2__ClassificationHierarchy__c WHERE Name = :optionGroupName LIMIT 1];
hierRequest.ProductId = prod.Id;
hierRequest.OptionGroupId = optionGroup.Id;
hierResponse = Apttus_Config2.CPQAdminWebService.getChildOptions(hierRequest);
return hierResponse;
}