How to Instantly Fix Broken Serial Tracking in BC Transfer Orders

When working with serialized items in Dynamics 365 Business Central, transfer orders between locations can sometimes encounter tracking issues. The system relies on proper reservation entries for serial numbers, but during complex warehouse processes, these entries can become corrupted or go missing. This blog post presents a solution to fix serial tracking issues in transfer orders without requiring manual intervention.

It’s important to note that these tracking issues are not common in standard Business Central implementations. However, when they do occur, manually repairing them can be extremely challenging, even for experienced administrators. Traditional methods like using Configuration Packages to correct reservation entries are complex, time-consuming, and prone to errors.

The Problem

Business Central’s warehouse management processes create and delete reservation entries at various stages (receipt, pick, shipment). When transferring serialized items between locations, several issues can occur:

What Causes These Issues?

In my experience, these problems typically arise from:

  1. Custom extensions with elevated privileges that modify or delete reservation entries inadvertently
  2. Interrupted processes where a system timeout or error occurs during critical transfer operations
  3. Bugs in customizations that handle serial numbers or tracking information

These issues typically result in error messages like “Item tracking does not match…” or “Serial number XXX must be assigned…” when trying to post receipts, forcing users to manually fix tracking information.

How It Works in Practice

Let’s walk through the process step by step:

1. Identifying the Problem

When you try to receive a transfer order with serialized items, you might notice that the item tracking lines are missing or incomplete:

If we click on “Item Tracking Lines” and then on “Shipment”, we can confirm that the serial numbers are present:

In this case, I’ve simulated an error that sometimes occurs where tracking information gets deleted or corrupted. When we click on “Item Tracking” and then on “Receipt”, we can see that no tracking information has been generated:

Often, users don’t notice this issue until they try to create and post the warehouse receipt for the transfer. When they click “Post”, they’ll encounter an error message like this:

2. Running the Correction Utility

The solution adds an action button to the transfer order page that allows you to run the correction process:

After clicking the button, a confirmation dialog appears to prevent accidental execution. After the process completes, you’ll see a success message like this:

3. Verification of Results

After running the utility, the item tracking page now shows the correct serial numbers retrieved from the registered pick lines:

Now, if we click on the “Item Tracking” for the Receipt, we can see that all the serial numbers have been properly restored:

Now the transfer receipt can be posted without any tracking errors, as Business Central recognizes the serial numbers correctly.

Code Overview

The solution consists of a codeunit Transfer Tracking Correction with three key procedures:

Main Procedure: CorrectTransferTrackings

This procedure takes a transfer order number and:

  • Validates the transfer order exists
  • Identifies existing surplus reservation entries to avoid duplication
  • Finds registered picks related to the transfer
  • For each serial number that doesn’t already have a surplus entry, creates one
  • Reports on the number of tracking lines corrected

GetExistingSurplusSerials

This procedure:

  • Retrieves all existing surplus reservation entries for the transfer
  • Creates a list of serial numbers that are already properly tracked
  • Helps avoid duplicate entries and focuses only on fixing missing ones

CreateSurplusReservationEntry

The heart of the solution (and perhaps the most challenging part to get right):

  • Finds the related transfer shipment line for accurate reference information
  • Creates a surplus reservation entry in the destination location
  • Sets all required fields correctly (quantities, tracking status, dates)
  • Ensures proper linking to the original transfer line

The most complex aspect of this procedure was understanding which fields to use for correct references. After extensive testing, I discovered that two specific field assignments were critical:

SourceRefNo := TransferShipmentLine."Derived Trans. Order Line No."

and

ReservationEntry."Source Prod. Order Line" := RegisteredPick."Source Line No."

These references ensure that Business Central correctly associates the serial numbers with both the transfer order and the underlying warehouse operations.

When To Use This Solution

This utility is most helpful in scenarios where:

  1. Large volumes of serialized items are transferred between locations
  2. Custom extensions or processes have been implemented that might interfere with standard tracking
  3. Users encounter persistent item tracking errors when receiving transfer orders
  4. System errors or timeouts have occurred during the transfer process
  5. You need to batch fix multiple transfer orders with tracking issues

Conclusion

Business Central’s item tracking system is powerful but can sometimes encounter issues during complex warehouse operations. This solution provides a reliable way to repair serial number tracking in transfer orders by rebuilding the necessary reservation entries. The code leverages existing data from registered picks and transfer shipment lines to ensure accurate reconstruction of tracking information.

By implementing this solution, you can save significant time that would otherwise be spent manually fixing tracking issues, especially in high-volume warehouse environments. The approach is non-invasive and only adds missing tracking entries without disturbing existing correct ones.

While this solution has proven effective in our environment, I believe there’s always room for improvement. Alternative approaches might include:

  1. Using different tables as sources for tracking information
  2. Implementing preventive measures to avoid the corruption in the first place
  3. Extending the solution to handle more complex scenarios like lot-tracked items

If you have insights on how to make this solution more robust or efficient, I welcome your contributions and suggestions. The Business Central community thrives on shared knowledge and collaborative problem-solving.

The complete code is available on my GitHub repository, where you can download and adapt it to your specific Business Central implementation.

Leave a Reply

Your email address will not be published. Required fields are marked *