You can use this API to create new categories with the minimum required parameters like name, type, and label.

APISignature
createCategories()webService static Apttus_Config2.CPQAdminStruct.CategoryResponseDO createCategories(Apttus_Config2.CPQAdminStruct.CategoryRequestDO categoryRequestDO)


Request Parameter
NameTypeDescription
categoryRequestDOApttus_Config2.CPQAdminStruct.CategoryRequestDOThe category request data object.



Request Data Object - Apttus_Config2.CPQAdminStruct.CategoryRequestDO
NameTypeDescription
CategoryDOsList<Apttus_Config2.CPQAdminStruct.CategoryDO>The list of category data objects.
Response Parameter - Apttus_Config2.CPQAdminStruct.CategoryResponseDO
FieldTypeDescription
CategoryDOsList<Apttus_Config2.CPQAdminStruct.CategoryDO>The list of category data objects.
CategoryResponseMapList<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
NameTypeDescription
LabelStringThe label of the category
NameStringThe name of the category
OptionalFieldsList<Apttus_Config2.CPQAdminStruct.MapDO>The list of optional field values. You can use this parameter to associate additional field values with the category.
TypeString 

Type of the category. You can use the following values:

  • Offering
  • Option Group
  • Both
Response Data Object - Apttus_Config2.CPQAdminStruct.MapDO
FieldTypeDescription
StringKeyThe name of the category.
StringValueThe 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);
}
CODE