Troubleshooting Custom Jobs for B2C Storefronts

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

Alert Resolution
A custom job can change only one order per transaction, or scalability issues can occur. Review your custom jobs.

Review the source code in your custom job script to make sure that the custom job changes only one order per transaction.

Example: Your code modifies multiple orders in a transaction.

var order1 = OrderMgr.getOrder(parameters.orderNo1 ); 
var order2 = OrderMgr.getOrder(parameters.orderNo2 ); 
Transaction.wrap(function() { 
   order1.setExternalOrderText(aValueToBeSet);
   order2.setExternalOrderText(aValueToBeSet); 
});

Change your code to only modify one order per transaction.

var order1 = OrderMgr.getOrder(parameters.orderNo1 ); 
var order2 = OrderMgr.getOrder(parameters.orderNo2 ); 
Transaction.wrap(function() { 
   order1.setExternalOrderText(aValueToBeSet); 
});
Transaction.wrap(function() {
   order2.setExternalOrderText(aValueToBeSet); 
});

Benefits:

  • 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.
  • Potential optimistic locking exceptions are reduced to a single order. The shorter internal locking time reduces the likelihood of running into optimistic locking issues.
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. 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 Delay Order Exports for B2C Stores.