---
schema_version: "1"
id: db3f272038cb00c8218225b598bc79a3c6bf530f7defa18d707ccec9fea1140a
title: Product Hierarchy Maintenance
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/ind/264-0-0/comms_product_hierarchy_maintenance.md
canonical_url: https://help.salesforce.com/s/articleView?id=ind.comms_product_hierarchy_maintenance.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 82bda1845448b61840e946d98121fcdc59683f5eeb11f4285d1cba85e25ac61e
description: 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.
products:
  - Communications
  - Media
  - Energy and Utilities
release: "264"
---
# 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.

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
      <colgroup>
        <col style="width:50%">
        <col style="width:50%">
      </colgroup>
      <thead class="slds-text-title_caps ">
        <tr class="">
          <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d317553e34">
            <p style="margin-bottom:0;">Applies to</p>
          </th>
          <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d317553e40">
            <p style="margin-bottom:0;">All releases</p>
          </th>
        </tr>
      </thead>
      <tbody>
        <tr class="">
          <td data-label="Applies to" class="slds-cell-wrap" style="vertical-align:top;" headers="d317553e34 ">
            <p style="margin-bottom:0;">Apex Name</p>
          </td>

          <td data-label="All releases" class="slds-cell-wrap" style="vertical-align:top;" headers="d317553e40 ">
            <p style="margin-bottom:0;">
              <code>ResolveProductHierarchyBatchJob</code>
            </p>
          </td>

        </tr>
        <tr class="">
          <td data-label="Applies to" class="slds-cell-wrap" style="vertical-align:top;" headers="d317553e34 ">
            <p style="margin-bottom:0;">Where to Run This Job</p>
          </td>

          <td data-label="All releases" class="slds-cell-wrap" style="vertical-align:top;" headers="d317553e40 ">
            <p style="margin-bottom:0;">Maintenance Jobs in the Admin Console section on the CMT
              Administration tab.</p>
          </td>

        </tr>
        <tr class="">
          <td data-label="Applies to" class="slds-cell-wrap" style="vertical-align:top;" headers="d317553e34 ">
            <p style="margin-bottom:0;">Risks of Running This Job</p>
          </td>

          <td data-label="All releases" class="slds-cell-wrap" style="vertical-align:top;" headers="d317553e40 ">
            <p>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.</p>
            <p>Avoid running this job in a production environment
              outside of scheduled downtimes because of the risks.</p>
            <p style="margin-bottom:0;">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.</p>
          </td>

        </tr>
        <tr class="">
          <td data-label="Applies to" class="slds-cell-wrap" style="vertical-align:top;" headers="d317553e34 ">
            <p style="margin-bottom:0;">When Not to Run This Job</p>
          </td>

          <td data-label="All releases" class="slds-cell-wrap" style="vertical-align:top;" headers="d317553e40 ">
            <p style="margin-bottom:0;">N/A</p>
          </td>

        </tr>
        <tr class="">
          <td data-label="Applies to" class="slds-cell-wrap" style="vertical-align:top;" headers="d317553e34 ">
            <p style="margin-bottom:0;">When to Run This Job</p>
          </td>

          <td data-label="All releases" class="slds-cell-wrap" style="vertical-align:top;" headers="d317553e40 ">
            <ul>
              <li>
                <p>After any changes to the product hierarchy or
                  product cardinality in the Vlocity Product Console</p>
              </li>

              <li>
                <p>After upgrading Vlocity Communications</p>
              </li>

              <li>
                <p>After spinning a new org</p>
              </li>

              <li>
                <p>Before running the <a href="https://help.salesforce.com/s/articleView?id=ind.comms_refresh_platform_cache_full.htm&amp;release=264.0.0&amp;type=5" title="This job copies product hierarchy data to the platform cache and rebuilds the product attribute cache.">Refresh Platform Cache (Full)</a> or the <a href="https://help.salesforce.com/s/articleView?id=ind.comms_refresh_platform_cache_incremental.htm&amp;release=264.0.0&amp;type=5" title="The Refresh Platform Cache (Incremental) job updates the platform cache with changes in the product hierarchy without deleting existing data. Run the Product Hierarchy Maintenance job before you start the Refresh Platform Cache (Incremental) to ensure that changes to product bundles are properly reflected in your implementation.">Refresh Platform Cache (Incremental)</a> job</p>
              </li>

            </ul>
          </td>

        </tr>
        <tr class="">
          <td data-label="Applies to" class="slds-cell-wrap" style="vertical-align:top;" headers="d317553e34 ">
            <p style="margin-bottom:0;">Delete Old Data Option</p>
          </td>

          <td data-label="All releases" class="slds-cell-wrap" style="vertical-align:top;" headers="d317553e40 ">
            <p style="margin-bottom:0;">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.</p>
          </td>

        </tr>
        <tr class="">
          <td data-label="Applies to" class="slds-cell-wrap" style="vertical-align:top;" headers="d317553e34 ">
            <p style="margin-bottom:0;">More Information</p>
          </td>

          <td data-label="All releases" class="slds-cell-wrap" style="vertical-align:top;" headers="d317553e40 ">
            <p>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.</p>
            <p>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.</p>
            <p>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.</p>
            <p>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.</p>
            <p>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:</p>
            <p>
              <code>CMTAdminJobService.startProductHierarchyMaintenanceJob(pricebookId)</code>
            </p>
            <p>To run these jobs on all price books, substitute <code>null</code> for the price book ID.</p>
            <p>Running the command <code>vlocity_cmt.CMTAdminJobService.startProductHierarchyMaintenanceJob(null)</code>
              also triggers the DeleteProdHierDataStoreRecordsBatchJob. Here's an example
              of of you can run <code>vlocity_cmt.CMTAdminJobService.startProductHierarchyMaintenanceJob(null)</code>
              without triggering DeleteProdHierDataStoreRecordsBatchJob.</p>
            <div>
              <pre class="line-numbers slds-box slds-box_x-small slds-theme_shade slds-m-top_medium slds-m-bottom_medium slds-scrollable_x"><code class="language-java">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();</code></pre>
            </div>
          </td>

        </tr>
        <tr class="">
          <td data-label="Applies to" class="slds-cell-wrap" style="vertical-align:top;" headers="d317553e34 ">
            <p style="margin-bottom:0;">Troubleshooting</p>
          </td>

          <td data-label="All releases" class="slds-cell-wrap" style="vertical-align:top;" headers="d317553e40 ">
            <p>If the following error occurs:</p>
            <pre class="line-numbers slds-box slds-box_x-small slds-theme_shade slds-m-top_medium slds-m-bottom_medium slds-scrollable_x"><code>SendEmail failed. First exception on row 0; first error: NO_MASS_MAIL_PERMISSION, Single email is not enabled for your organization or profile.</code></pre>
            <p style="margin-bottom:0;">Go to <strong class="uicontrol">Setup
                &gt; Deliverability</strong>. Ensure that <strong class="uicontrol">Access Level</strong> is set to
              <strong class="uicontrol">All Email</strong>.
            </p>
          </td>

        </tr>
      </tbody>
    </table>