Product Hierarchy Maintenance

This job builds a streamlined version of the product hierarchies in the Data Store sObjects, enabling the (formerly ) and Refresh Platform Cache (Incremental) jobs to use the hierarchy data.

Applies to

All releases

Apex Name

ResolveProductHierarchyBatchJob

Where to Run This Job

Maintenance Jobs in the Admin Console section on the CMT Administration tab.

Risks of Running This Job

The Product Hierarchy Maintenance job deletes all records in the Data Store sObject with a Product Hierarchy record type after it builds the new records.

Avoid running this job in a production environment outside of scheduled downtimes because of the risks.

You can run this job in a production environment during off-peak hours or planned downtime. This job can take a long time to run. When a production environment is in use and this job is run, order capture might have inconsistent results.

When Not to Run This Job

N/A

When to Run This Job

Delete Old Data Option

With Fall '20 and later, you can enable this option to delete the older, inactive dataset. Only the new, rebuilt dataset is available. Enabling this option can save storage space. See the More Information section about how datasets are used for this job.

More Information

The Product Hierarchy Maintenance job is a global job that reads the product child items across the shared catalog and creates a flat version of the product hierarchy in the Data Store sObject to enable quick access to child record IDs at runtime. Messages appear in the CMT Administration screen after successfully completing the Product Hierarchy Maintenance job and administrators receive email notification.

After running this job, click Refresh Platform Cache (Full) or Refresh Platform Cache (Incremental) to run the ProductHierarchyBatchProcessor and copy the new product hierarchy data to the platform cache.

With Fall '20, running the Product Hierarchy Maintenance job no longer requires downtime. Users can continue to work while the job runs. The Product Hierarchy Maintenance job uses a new cached data set, and there are two sets of data: the current one which is active and the new one that the job is building, which is inactive. Any changes to Products and the PCIs are recorded in the new dataset. When PHM completes, the older dataset is deactivated, and the new one is activated.

Vlocity Mobile also uses the Data Store sObject to store application definition records. If you are using the Vlocity Mobile application, ensure that your mobile application definition does not create records using the Product Hierarchy record type. Otherwise, the Product Hierarchy Maintenance job deletes them.

You can use the following Apex method to programmatically run the Product Hierarchy Maintenance, Clear Managed Platform Cache, and Refresh Platform Cache jobs in sequence:

CMTAdminJobService.startProductHierarchyMaintenanceJob(pricebookId)

To run these jobs on all price books, substitute null for the price book ID.

Running the command vlocity_cmt.CMTAdminJobService.startProductHierarchyMaintenanceJob(null) also triggers the DeleteProdHierDataStoreRecordsBatchJob. Here's an example of of you can run vlocity_cmt.CMTAdminJobService.startProductHierarchyMaintenanceJob(null) without triggering DeleteProdHierDataStoreRecordsBatchJob.

vlocity_cmt.TelcoAdminConsoleController telcoAdminConsoleController = new vlocity_cmt.TelcoAdminConsoleController();

telcoAdminConsoleController.setParameters('{"methodName":"startProductHierarchyJob", "deleteOldData":"false"}');

telcoAdminConsoleController.invokeMethod();

telcoAdminConsoleController.setParameters('{"methodName":"clearPlatformCache"}');

telcoAdminConsoleController.invokeMethod();

telcoAdminConsoleController.setParameters('{"methodName":"refreshPricebook"}');

telcoAdminConsoleController.invokeMethod();

Troubleshooting

If the following error occurs:

SendEmail failed. First exception on row 0; first error: NO_MASS_MAIL_PERMISSION, Single email is not enabled for your organization or profile.

Go to Setup > Deliverability. Ensure that Access Level is set to All Email.