Hay guys, I had a great shipping API customisation which was working, however it stopped working. I went to debug and this method of accessing the packages doesn’t work anymore. Any advice?
When I query pack I get zero pack’s even though I can see them in the database.
So I tried the below:
SOShipmentEntry shipGraph = Base as SOShipmentEntry;
var pack = PXSelect<SOPackageDetailEx, Where<SOPackageDetailEx.shipmentNbr, Equal<Current<SOShipment.shipmentNbr>>>>.Select(shipGraph);
I am still getting zero packs returned from pack.
Please help, I don’t know how to code this any other way.
Best answer by Suddens
I found the Problem!
I was calling the Base.Document where as I should have been calling Base.CurrentDocument.
When calling Base.Document I could successfully access some of the data from the current document however, any Base queries after this command were calling the wrong transaction from the shipGraph.
SOShipment orderMain = Base.Document.SelectSingle(); // Don’t ever do this
SOShipment document = Base.CurrentDocument.SelectSingle(); // Works well
For some reason this customisation has been working for about 3 months without an error. All of a sudden, an upgrade breaks it.
Thank you for the help everyone. If anyone knows why this error occurred that would be useful information.
I am getting the wrong shipment number returned from the “CurrentDocument”.
...
Do you think the “CurrentDocument” has changed?
I was going to ask if your shipGraph was looking at the right transaction but think you’ve already determined that it isn’t. :) I’m thinking there’s an issue with pointing your shipGraph to the correct transaction to begin with or some process is moving it to another shipment before you get a chance to look at your package records.
I was calling the Base.Document where as I should have been calling Base.CurrentDocument.
When calling Base.Document I could successfully access some of the data from the current document however, any Base queries after this command were calling the wrong transaction from the shipGraph.
SOShipment orderMain = Base.Document.SelectSingle(); // Don’t ever do this
SOShipment document = Base.CurrentDocument.SelectSingle(); // Works well
For some reason this customisation has been working for about 3 months without an error. All of a sudden, an upgrade breaks it.
Thank you for the help everyone. If anyone knows why this error occurred that would be useful information.