You can use this API to create products.

APISignature
createProductswebService static Apttus_Config2.CPQAdminStruct.ProductResponseDO createProducts(Apttus_Config2.CPQAdminStruct.ProductRequestDO productRequestDO)


Request Parameter
NameTypeDescription
productRequestDOApttus_Config2.CPQAdminStruct.ProductRequestDO The create products request data object.



Request Data Object - Apttus_Config2.CPQAdminStruct.ProductRequestDO
NameTypeDescription
ProductDOsList<Apttus_Config2.CPQAdminStruct.ProductDO>The list of product data objects.
Data Object - Apttus_Config2.CPQAdminStruct.ProductDO
NameTypeDescription
NameStringThe name of the product
ConfigTypeString 

Type of configuration of the product. You can use the following values:

  • Standalone
  • Bundle
  • Option
IsActiveBooleanIndicates whether the product should be active or inactive.
OptionalFieldsList<Apttus_Config2.CPQAdminStruct. MapDO>The list of optional field values. You can use this parameter to associate additional field values with the product.
CategoryIdIdThe Id of the category to which the products must be associated to.
Response Parameter - Apttus_Config2.CPQAdminStruct.ProductResponseDO 
FieldTypeDescription
ProductStructureJSON

List<Apttus_Config2.CPQAdminStruct.MapDO>

The list of key-value pairs. The key refers to the product name that was passed in the request and the value refers to the Id of the product.

Response Data Object - Apttus_Config2.CPQAdminStruct.MapDO
FieldTypeDescription
StringKeyThe name of the product.
StringValueThe value refers to the Id of the product.


Code Sample

The sample code below enables you to create products


/**
 * The below code demonstrates how to create one standalone and one bundle products for the given category Id
 */

Public void createProducts() 
{

	Apttus_Config2.CPQAdminStruct.ProductRequestDO request = new Apttus_Config2.CPQAdminStruct.ProductRequestDO();
	Apttus_Config2.CPQAdminStruct.ProductDO productDO = new Apttus_Config2.CPQAdminStruct.ProductDO();
	List<Apttus_Config2.CPQAdminStruct.MapDO> listOfMapDO = new List<Apttus_Config2.CPQAdminStruct.MapDO>();
	Apttus_Config2.CPQAdminStruct.MapDO m = new Apttus_Config2.CPQAdminStruct.MapDO();

	// ADD 1ST PRODUCT
	// required fields
	productDO.Name = Standalone Product Name';
	productDO.ConfigType = 'Standalone';
	productDO.IsActive = true;

	// additional fields (Please use namespace for the fields outside your ORG)
	// 1st additional field 
	m.Key = ' Description'; 
	m.Value = 'Standalone product description';
	listOfMapDO.add(m);

	// 2nd additional field
	m = new Apttus_Config2.CPQAdminStruct.MapDO();
	m.Key =  ' Apttus_Config2__HasOptions__c';
	m.Value = 'false';
	listOfMapDO.add(m);

	// 3rd additional field
	m = new Apttus_Config2.CPQAdminStruct.MapDO();
	m.Key = ' Apttus_Config2__EffectiveDate__c';
	m.Value = '2016-01-13 02:28:00';
	listOfMapDO.add(m);
	// add additional fields to the optionalFields list
	productDO.OptionalFields.addAll(listOfMapDO);

	// ADD 2ND PRODUCT 
	request.ProductDOs.add(productDO);
	productDO = new Apttus_Config2.CPQAdminStruct.ProductDO();
	
	// required fields
	productDO.Name = ‘Bundle Product Name';
	productDO.ConfigType = 'Bundle';
	productDO.IsActive = true;

	// additional fields
	m = new Apttus_Config2.CPQAdminStruct.MapDO();

	// 1st additional field
	m.Key = 'Description';
	m.Value = 'Bundle product description';
	listOfMapDO.add(m);
	
	// 2nd additional field
	m = new Apttus_Config2.CPQAdminStruct.MapDO();
	m.Key = 'Apttus_Config2__HasOptions__c';
	m.Value = 'true';
	listOfMapDO.add(m);
	
	// 3rd additional field
	m = new Apttus_Config2.CPQAdminStruct.MapDO();
	m.Key = 'Apttus_Config2__EffectiveDate__c';
	m.Value = '2021-01-01 15:24:00';
	listOfMapDO.add(m);
	
	// add optional fields to the optionalFields list
	productDO.OptionalFields.addAll(listOfMapDO);
	productDO.categoryID = 'a0i6C000001tnac'; // Id of any existing category
	
	// add product to request
	request.ProductDOs.add(productDO);
	Apttus_Config2.CPQAdminStruct.ProductResponseDO response = Apttus_Config2.CPQAdminWebService.createProducts(request);
}
CODE