You can use this API to associate a product to a category.

APISignature
associateProductToCategory

webService static Boolean associateProductToCategory(Apttus_Config2.CPQAdminStruct.ProductRequestDO productsRequestDO)

Request Parameter
NameTypeDescription
productsRequestDOApttus_Config2.CPQAdminStruct.ProductRequestDOThe category request data object.
Data Object - Apttus_Config2.CPQAdminStruct.ProductDO
NameTypeDescription
ProductIdIdThe ID of the product you want to associate with the category
CategoryIdIdThe Id of the category to which the products must be associated to.



Response Parameter
NameTypeDescription
IsSuccessfulBooleanIndicates whether the association of product to the category was successful or not.


Code Sample

The below sample code enables you to associate the product to a specific category.


/**
 * The below code associate the products with related category. Invoke below method by passing map of productid and categoryId as parameter.
 */

Public Boolean associateProductToCategory(Map<Id, Id> mapProductIdCategoryId) 
{
	Apttus_Config2.CPQAdminStruct.ProductRequestDO prodsAssocRequest = new Apttus_Config2.CPQAdminStruct.ProductRequestDO();
	CPQAdminStruct.ProductDO prodForAssociation = null;
	For (Id productId : mapProductIdCategoryId. keySet()) {
		prodForAssociation.productID = prodIDs[i];
		prodForAssociation.categoryID = categIDs[i];
		prodsAssocRequest.ProductDOs.add(prodForAssociation);	
	}
	
	return Apttus_Config2.CPQAdminWebService.associateProductToCategory(prodsAssocRequest);
}
CODE