web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Expiration Date must not change for an item tracked by lot number

(0) ShareShare
ReportReport
Posted on by
Since the release of BC23 SaaS, there's an issue with the OnValidate() of the Expiration Date field in the Warehouse Journal Line.
 
We have some custom code to fill in the Warehouse Journal at a certain moment of time (with scanner functionality), and we use a Validate() of the Expiration Date.
In BC22, there was no issue when using a 0D as Expiration Date to do this. However, in BC23, an error occurs when doing this:
/Expiration Date must not change for an item tracked by lot number./
 
In BC22, there was no code in the OnValidate() trigger of the /Expiration Date/ field on the Warehouse Journal Line. Now, in BC23, there is 1 line of code:
CheckLotNoTrackedExpirationDate();
 
Besides the fact that it's not initializing /Item Tracking Setup/ anywhere but using it, there's an other issue:
In some point of time, when you dig deeper into the next functions that are called, the following function is called:
ItemTrackingManagement.GetWhseExpirationDate(...)
This function is NOT doing/checking correct on Expiration Date. It only checks if there's an Item Ledger Entry which is Positive, and then returns TRUE, which results eventually in the error /Expiration Date must not change for an item tracked by lot number./. Since the expiration date is filled with 0D, the error should not occur (because there were NO entries with an Expiration Date, and the journal line also will have no Expiration Date).
 
To fix this, the code in Item Tracking Management, and also the functions ExistingExpirationDate() and WhseExistingExpirationDate() should be reviewed.
Both functions just check if there are entries (Item Ledger Entries for the first one, Warehouse Entries for the second one). For both functions, IF there are Item Ledger Entries / Warehouse Entries for the item, the /EntriesExist/ will be TRUE.
So the result will be that it exits with the first function already, and with an ExpiryDate = 0D. This will result in an error in CheckLotNoTrackedExpirationDate() in the Warehouse Journal Line:
 
In my opinion, there should be a little code change in GetWhseExpirationDate(), namely:
change:
        if EntriesExist then
            exit(true);
into:
        if EntriesExist and (ExpiryDate <> 0D) then
            exit(true);
 
In that case, there will be no exit(true), but just continuing and getting to the next code:
I have the same question (0)
  • Suggested answer
    YUN ZHU Profile Picture
    99,544 Super User 2026 Season 1 on at
    Hi, if you think there is a problem with the standard function, you can try submitting it to the following two places.
     
    Hope this helps.
    Thanks.
    ZHU

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,933 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,055 Super User 2026 Season 1

#3
Teagen Boll Profile Picture

Teagen Boll 640 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans