This method allows you to run the Category maintenance for multiple categories. This is applicable to only those categories which have products associated to them. You can invoke this API when a user clicks Update View button in the Category Hierarchy.


APISignature
updateCategoryViewsstatic Id updateCategoryViews(Set hierarchyIds)
Request Parameter
NameTypeDescription
hierarchyIdsSet<ID>

This is the set containing the IDs of the category hierarchy records.

Response Parameter
NameTypeDescription
apexBatchJobId

ID

The ID of the Batch Job run.


Code sample

The code described below is used to run the Category Maintenance for multiple Category Hierarchies after you associate new products or modify the existing products under multiple categories. You can also use this API when associate a Price List Item to a Category, under the related list, Price List Category. This method takes up the set of IDs of the category hierarchy records and returns the Batch job ID after success.


public void updateCategoryViews(List<String> categoryNames)
{
	Set<ID> hierarchyIds = new Set<ID>();
	for(String categoryName : categoryNames)
	{
		List<Apttus_Config2_ClassificationName_c> categoryList = [SELECT ID FROM Apttus_Config2_ClassificationName_c WHERE Name =: categoryName];
		hierarchyIds.add(categoryList[0].ID);
	}              
	
	ID apexBatchJobId = Apttus_CpqApi.BatchUpdateService.updateCategoryViews(hierarchyIds);
    
	ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.info, 'Apex Batch Job Id : ' + apexBatchJobId));
}
CODE