Skip to main content
Solved

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


Forum|alt.badge.img

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

Best answer by brettnothan9

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

Brett

View original
Did this topic help you find an answer to your question?

7 replies

Forum|alt.badge.img
  • Jr Varsity III
  • 25 replies
  • June 4, 2021

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


Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • 21 replies
  • June 4, 2021

Good point.Using version 21.106


Forum|alt.badge.img
  • Jr Varsity III
  • 25 replies
  • Answer
  • June 4, 2021

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

Brett


Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • 21 replies
  • June 7, 2021

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?

 


Forum|alt.badge.img
  • Varsity II
  • 35 replies
  • June 7, 2021

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.


Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • 21 replies
  • June 7, 2021

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


  • Freshman II
  • 4 replies
  • May 7, 2023

@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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings