Download page Updating Category Hierarchy for a single Category.
Updating Category Hierarchy for a single Category
This method allows you to run the Category maintenance for a single category. 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.
API
Signature
updateCategoryView
static Id updateCategoryView(Id hierarchyId)
Request Parameter
Name
Type
Description
hierarchyId
ID
This is the ID of the category hierarchy record.
Response Parameter
Name
Type
Description
apexBatchJobId
ID
The ID of the Batch Job run.
Code sample
The code described below is used to run the Category Maintenance after you associate new products or modify the existing products under a category. 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 ID of the category hierarchy record and returns the Batch job ID after success.
public void updateCategoryView(String categoryName)
{
List<Apttus_Config2_ClassificationName_c> categoryList = [SELECT ID FROM Apttus_Config2_ClassificationName_c WHERE Name =: categoryName];
String hierarchyId = categoryList[0].ID;
ID apexBatchJobId = Apttus_CpqApi.BatchUpdateService.updateCategoryView(hierarchyId);
ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.info, 'Apex Batch Job Id : ' + apexBatchJobId));
}