Solved

How can I print Shipment Confirmation form SO642000 automatically upon status changing to Confirmed?

  • 4 June 2021
  • 7 replies
  • 495 views

Userlevel 3
Badge

The user is confirming the shipments automatically upon the write-back after shipping in StarShip and they would like the Shipment Confirmation to print at that point.

I need to print the Shipment Confirmation form (via Device Hub if needed) when the Shipment status changes to Confirmed.

Thanks

icon

Best answer by brettnothan9 4 June 2021, 23:12

View original

7 replies

Userlevel 2
Badge

What version are you running?  I believe this would be easy with the new workflow capabilities.

Userlevel 3
Badge

Good point.Using version 21.106

Userlevel 2
Badge

I would try flipping this Auto-Run Action to True and see what happens.

Brett

Userlevel 3
Badge

Thanks for the suggestion. I flipped the Print Shipment Confirmation to True. The report runs automatically and opens in a new tab with the right data. That would take us 50% of the way. The final step needs to be triggering the print job directly to DeviceHub. Any suggestions to achieve that?

 

Userlevel 3
Badge

I’d do this with a customization. You’d want to create a field updated event handler for the status field, check if the status switched to confirmed, and if it has, print the document. It should look something like this:
 

public class SOShipmentEntryExt : PXGraphExtension<SOShipmentEntry>
{

protected void _(Events.FieldUpdated<SOShipment.status> e)
{
var row = (SOShipment)e.Row;
if (row == null) return;

if ((string)e.OldValue != "F" && (string)e.NewValue == "F")
{
Dictionary<string, string> printParams = new Dictionary<string, string>();
printParams["Shipment Nbr"] = row.ShipmentNbr;

PXReportRequiredException ex = null;
ex = PXReportRequiredException.CombineReport(ex, "Report ID", printParams);

PX.SM.SMPrintJobMaint.CreatePrintJobGroup("Device Hub Printer Name", ex, "Report Name");
}


}
}


Of course you’ll want to fill this out with your information, for example put your actual Report ID instead of literally “Report ID”. It still needs to be in quotes though. Also, make sure your parameters actually match for the report you’re trying to print. I just threw this together real quick as an example.

Also note, “F” is the value the database stores for confirmed shipments. That’s why that’s there.

Userlevel 3
Badge

The customization will be the way to go. Thank you all for your support.

@jknauf 

 

Thanks for the insight on this one. I am to the same point that @gpineda64 was at that the PDF opening once confirmed. The script you wrote makes sense, but I want to be sure I am putting it in the correct place. 

 

Under what portion of the customization would you place this script?

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved