Creating New Categories
You can use this API to create new categories with the minimum required parameters like name, type, and label.
API |
Signature |
---|---|
createCategories() |
webService static Apttus_Config2.CPQAdminStruct.CategoryResponseDO createCategories(Apttus_Config2.CPQAdminStruct.CategoryRequestDO categoryRequestDO) |
Request Parameter |
||
---|---|---|
Name |
Type |
Description |
categoryRequestDO | Apttus_Config2.CPQAdminStruct.CategoryRequestDO |
The category request data object. |
Request Data Object - Apttus_Config2.CPQAdminStruct.CategoryRequestDO |
||
---|---|---|
Name |
Type |
Description |
CategoryDOs | List<Apttus_Config2.CPQAdminStruct.CategoryDO> |
The list of category data objects. |
Response Parameter - Apttus_Config2.CPQAdminStruct.CategoryResponseDO |
||
---|---|---|
Field |
Type |
Description |
CategoryDOs | List<Apttus_Config2.CPQAdminStruct.CategoryDO> |
The list of category data objects. |
CategoryResponseMap | List<Apttus_Config2.CPQAdminStruct.MapDO> |
The list of key-value pairs. The key refers to the category name that was passed in the request and the value refers to the Id of the category. |
Data Object - Apttus_Config2.CPQAdminStruct.CategoryDO |
||
---|---|---|
Name |
Type |
Description |
Label | String |
The label of the category |
Name | String |
The name of the category |
OptionalFields | List<Apttus_Config2.CPQAdminStruct.MapDO> |
The list of optional field values. You can use this parameter to associate additional field values with the category. |
Type | String |
Type of the category. You can use the following values:
|
Response Data Object - Apttus_Config2.CPQAdminStruct.MapDO |
||
---|---|---|
Field |
Type |
Description |
String | Key |
The name of the category. |
String | Value |
The value refers to the Id of the category. |
Code Sample
The below sample enables you to create categories. You can also add optional fields, add the namespace to the field names.
/**
* The below code create categories of type Option Group and Offering
*/
Public void createCategories()
{
Apttus_Config2.CPQAdminStruct.CategoryResponseDO categsResponse = null;
Apttus_Config2.CPQAdminStruct.CategoryRequestDO categsRequest = new Apttus_Config2.CPQAdminStruct.CategoryRequestDO();
Apttus_Config2.CPQAdminStruct.CategoryDO categDO = null;
List<Apttus_Config2.CPQAdminStruct.MapDO> mapDOList = null;
Apttus_Config2.CPQAdminStruct.MapDO mapDO = null;
// CREATE 3 CATEGORIES:
// CREATING 1ST CATEGORY
// necessary fields
categDO = new Apttus_Config2.CPQAdminStruct.CategoryDO();
categDO.Name = 'CategoryOptionGroup1';
categDO.Label = 'CategoryOptionGroup1';
categDO.Type = 'Option Group';
mapDOList = new List<Apttus_Config2.CPQAdminStruct.MapDO>();
// additional fields
// 1st
mapDO = new Apttus_Config2.CPQAdminStruct.MapDO();
mapDO.Key = 'Apttus_Config2__GuidePage__c';
mapDO.Value = 'a page';
mapDOList.add(mapDO);
// 2nd
mapDO = new Apttus_Config2.CPQAdminStruct.MapDO();
mapDO.Key = 'Apttus_Config2__Active__c';
mapDO.Value = 'true';
mapDOList.add(mapDO);
// add categDO to categsRequest
categDO.OptionalFields = mapDOList;
categsRequest.CategoryDOs.add(categDO);
// CREATING 2ND CATEGORY
// necessary fields
categDO = new Apttus_Config2.CPQAdminStruct.CategoryDO();
categDO.Name = 'CategoryOffering1';
categDO.Label = 'CategoryOffering1';
categDO.Type = 'Offering';
// add categDO to categsRequest
categsRequest.CategoryDOs.add(categDO);
// CREATING 3RD CATEGORY
// necessary fields
categDO = new Apttus_Config2.CPQAdminStruct.CategoryDO();
categDO.Name = 'CategoryOptionGroup2';
categDO.Label = 'CategoryOptionGroup2';
categDO.Type = 'Option Group';
// add categDO to categsRequest
categsRequest.CategoryDOs.add(categDO);
// create categories
categsResponse = Apttus_Config2.CPQAdminWebService.createCategories(categsRequest);
}