---
schema_version: "1"
id: 466af4479fc71f51d51e5124b4b5804e22f927c3a187291adbbea0664568e885
title: Troubleshooting Custom Jobs for B2C Storefronts
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/cc/264-0-0/b2c_troubleshooting_custom_jobs.md
canonical_url: https://help.salesforce.com/s/articleView?id=cc.b2c_troubleshooting_custom_jobs.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 6c835da619afbfb85f1562564580c7cc55e42df73d280da509abecaa8db6b383
description: Use this table to resolve custom job alerts in Business Manager.
products:
  - Commerce
  - B2C Commerce
release: "264"
---
# Troubleshooting Custom Jobs for B2C Storefronts

Use this table to resolve custom job alerts in Business Manager.

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
      <colgroup>
        <col>
        <col>
      </colgroup>
      <thead class="slds-text-title_caps ">
        <tr class="">
          <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d173859e34">Alert</th>
          <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d173859e37">Resolution</th>
        </tr>
      </thead>
      <tbody>
        <tr class="">
          <td data-label="Alert" class="slds-cell-wrap" style="vertical-align:top;" headers="d173859e34 ">A custom job can change only one order per transaction, or scalability
            issues can occur. Review your custom jobs.</td>

          <td data-label="Resolution" class="slds-cell-wrap" style="vertical-align:top;" headers="d173859e37 ">
            <p>Review the source code in your custom job script to make sure that the
              custom job changes only one order per transaction. </p>
            <p>Example: Your code
              modifies multiple orders in a transaction.</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 class="language-javascript">var order1 = OrderMgr.getOrder(parameters.orderNo1 ); 
var order2 = OrderMgr.getOrder(parameters.orderNo2 ); 
Transaction.wrap(function() { 
   order1.setExternalOrderText(aValueToBeSet);
   order2.setExternalOrderText(aValueToBeSet); 
});</code></pre>
            <p>Change your code to only modify one order per transaction.</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 class="language-javascript">var order1 = OrderMgr.getOrder(parameters.orderNo1 ); 
var order2 = OrderMgr.getOrder(parameters.orderNo2 ); 
Transaction.wrap(function() { 
   order1.setExternalOrderText(aValueToBeSet); 
});
Transaction.wrap(function() {
   order2.setExternalOrderText(aValueToBeSet); 
});</code></pre>
            <p>Benefits:</p>
            <ul>
              <li>Small transactions on the order object reduce the internal locking time
                and increase throughput for the order data structures. This approach
                improves performance and scaling in your storefront.</li>

              <li>Potential optimistic locking exceptions are reduced to a single order.
                The shorter internal locking time reduces the likelihood of running into
                optimistic locking issues.</li>

            </ul>
          </td>

        </tr>
        <tr class="">
          <td data-label="Alert" class="slds-cell-wrap" style="vertical-align:top;" headers="d173859e34 ">Because of concurrent modification by another process, order export data
            can be out of sync or exported twice. Review your log messages and Developer
            Best Practices for details.</td>

          <td data-label="Resolution" class="slds-cell-wrap" style="vertical-align:top;" headers="d173859e37 ">Review your order export process to see if another process is modifying the
            order. To minimize the risk of another process modifying orders during export,
            delay order exports. For more information, see <a href="https://help.salesforce.com/s/articleView?id=cc.b2c_delaying_orders.htm&amp;type=5&amp;language=en_US" target="_blank">Delay Order Exports for B2C
              Stores</a>.</td>

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

#### See Also

- [Create Custom Job Step Types](https://developer.salesforce.com/docs/commerce/b2c-commerce/guide/b2c-custom-job-steps.htm)
- [Job Step ExportOrders](https://salesforcecommercecloud.github.io/b2c-dev-doc/docs/upcoming/jobstepapi/html/index.html?target=jobstep.ExportOrders.htm)
- [Edit Alert Settings for B2C Commerce](https://help.salesforce.com/s/articleView?id=cc.b2c_edit_alert_settings.htm&release=264.0.0&type=5 "An individual user can change the priority of an alert or prevent it from appearing on their homepage or header. This only impacts the notifications for that user.")