I have this code that was working fine on a production instance, but doesn’t work now that I am working on it from a development instance. The goal is to have specific lines that were manually added to a count receive a default expiration date of 1/1/2000. I have a method in a different code file that looks through every line in INPIDetail and uses a BQL query to assign the correct expiration dates.
The validation code works fine, but I can’t seem to duplicate the success of the default date assignment code despite changing event handlers, conditional checks etc.
The reason I’m doing this is to avoid an issue where when adding an expiring item to a count, it immediately wipes the entire count after entering the lot number and using OK, because it thinks the expiration date is missing, requiring the user to re-enter PI number and location to continue.


Here is my code so far:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using PX.Data;
using PX.Objects.CS;
using PX.Objects.GL;
using PX.Objects.IN.PhysicalInventory;
using PX.Objects.RQ;
using PX.Objects;
using PX.Objects.IN;
namespace PX.Objects.IN
{
public class INPICountEntry_Extension : PXGraphExtension<PX.Objects.IN.INPICountEntry>
{
#region Event Handlers
protected void INPIDetail_RowPersisting(PXCache cache, PXRowPersistingEventArgs e)
{
var row = (INPIDetail)e.Row;
if (row == null) return;
DateTime defaultDT = new DateTime(2000, 1, 1);
// Any lot number with a letter B or N at the start has to have a tracked expiry date on our Acumatica instance (format: B12345678910)
if (row.LotSerialNbr.IndexOf("B") == 0 || row.LotSerialNbr.IndexOf("N") == 0)
{
row.ExpireDate = (DateTime?)defaultDT;
}
}
#endregion
}
}Any suggestions would be fantastic.