When we try to confirm a shipment on the Shipments screen after a few seconds of processing we get an error saying this file already exists. This is on a system we are preparing to go live with and have recently restored a snapshot (Settings and Business Accounts) which cleared out all the previous SOs and Shipments etc. I suspect a file is still present from testing previously but don’t know what file or where or even how to start to find out where or what it is. This seems to be only happening with Ship Via that are UPS based.
Does anyone have any idea how to troubleshoot?
Acumatica uses a single file that is attached to the record to store label files. It is always the “zero record” in the array of attached files. I don’t remember whether it is visible or not to the end user… you can look in the attachments section of this record to see if you can find it. If more than one label is created, or you add a label where there was previously only one, it will refresh this file and create a single document with all labels for printing.
It’s likely that whether you can see this file from the GUI or not, there is a reference to it remaining in the database. I think in normal operations, the system should automatically delete the existing file and refresh it with new labels. But perhaps the database restore impacted file pointers or whatever… not quite sure without more info.
The problem was that when restoring the snapshot we had attachments being restored and a previous label name clashed with one it was trying to create. After going into ‘Search in Files’ and clearing our all labels created before the snapshot was restored it works again.
Because the file name for the UPS Label is based on the Tracking Number, this:
Is there a way to manipulate the filename so that it’s always unique?
What breaks immediately?
The “This File Already Exists” error reoccurs. UPS test mode returns a Tracking Number of “1ZXXXXXXXXXXXXXXXXX” for all labels. That file gets stored with a name of “Label #1ZXXXXXXXXXXXXXXXXX.ZPL” So, the moment I run a second Test Label, I get the “File Already Exists” error.
I can think of a few different ways to fix this. The one I would probably do is go in with DnSpy, and modify the code for this connector to randomize the UPS tracking number received by UPS, when the tracking number matches the test tracking number. Then there will be no conflict.
Note to the Acumatica development team...it’s probably always a good idea to randomize file names that are based on some external identifier. For example, if the UPS tracking number is ABC123, then:
ABC123 + “-” + date() + rand(5) [this is just pseudocode]
Now the likelihood that we ever have a conflict is effectively zero. It also helps with debug, because we always know the date that the file was posted to the system, even if this isn’t tracked anywhere else. So if we get into a debug situation where we’re not sure how a file ended up somewhere, we have a useful piece of information about when the file post happened. If we want to reject files that are duplicates, we can do that deliberately, not as a result of the system failing due to a duplicate file name.
Duplicate production tracking numbers are more common than you think. I have over 250,000 from the last 8 years, some with a window as small as 9 months and an average window of about 3.5 years.
If you are a programmer, I can walk you through how to fix this with dnSpy. If you aren’t, you may be out of luck, unless Acumatica has a fix.
We are still new with acumatica and haven’t done much customization (and nothing yet with dnSpy). Any insights would be helpful!
This is from PX.Objects.SO.SOShipmentEntry.ShipPackages…(see below code snippet)
So yeah.. you can see that packageData.TrackingNumber is the file name, and packageData.Format is obviously ZPL (based on what you posted above). ZPL is a popular format for printing to a label printer.
So you could add a line similar to:
if(packageData.TrackingNumber == “1ZXXXXXXXXXXXXXXXXX”)
var tracktest = System.DateTime.Now.ToUniversalTime();
var faketrackingnumber = “1Zxxxxxxx” + tracktest.Substring(0, 10);
packageData.TrackingNumber = faketrackingnumber;
A few things here:
I see that your partner has logged a Customer Care case on your behalf for this. I added this Community thread to the case.
@Jacob - did you find a solution for this one? Thank you!