Salesforce Order Management Administrator AP study materials
Salesforce Order Management Administrator AP study resources

Inventory Reservation Conflicts During Peak Sales

Salesforce Order Management Administrator AP · Put your knowledge to work in context.

All case studies

Inventory Reservation Conflicts During Peak Sales

A company uses Salesforce Order Management to manage inventory across three fulfillment centers. During a flash sale, orders are being placed rapidly. The inventory reservation process is failing for 15% of orders with the error: 'Insufficient inventory to reserve.' However, real-time inventory reports show that each fulfillment center has enough stock to cover all orders. The reservation process uses a custom Apex class that queries inventory records and updates the 'Reserved' quantity. The company has a nightly batch job that recalculates inventory availability. The flash sale lasts for two hours, and the error rate increases as the sale progresses.

1. What is the likely cause of the inventory reservation failures, and how would you confirm it?

Read the worked answer

The most likely cause is a race condition or stale inventory data. The custom Apex class might be reading inventory records without locking them, leading to multiple transactions attempting to reserve the same inventory simultaneously. Alternatively, the nightly batch job might not have run recently, so the 'Available' quantity is not up-to-date, but the error says 'insufficient inventory' despite real-time reports showing enough stock. Another possibility: the custom class queries inventory at the fulfillment center level but doesn't account for inventory that is already reserved but not yet allocated. To confirm: 1) Check the Apex class for use of FOR UPDATE or other locking mechanisms. 2) Review debug logs for concurrent reservation attempts. 3) Compare the 'Reserved' quantity in the inventory records with the sum of reservations from orders. 4) Run the nightly batch job manually and see if the error persists.

2. What solution would you propose to ensure accurate inventory reservation during high-volume periods?

Read the worked answer

Implement a robust inventory reservation mechanism using Salesforce's standard Inventory Reservation API or a custom solution with proper locking. Use the 'Reserve Inventory' action in a flow or Apex with FOR UPDATE to lock inventory records during reservation. Alternatively, use Salesforce's Order Management standard inventory reservation features, which handle concurrency. If custom code is necessary, implement a queue-based system to serialize reservations or use Platform Events to process reservations asynchronously. Also, ensure that the nightly batch job runs more frequently during peak periods, or replace it with real-time inventory updates. Consider implementing a reservation timeout to release inventory if payment is not completed within a certain time.