Skip to main content
Question

Trying to Send a print job to device hub for different Order type. Error in customisations

  • March 14, 2025
  • 1 reply
  • 8 views

Forum|alt.badge.img

I have installed the device hub. I am a bit of rookie when it comes to customisations hence asking here.

What I am trying to achieve is when I quick process from Sales order screen I want to print Cash Slip for order type CSL to DOCKET printer  and normal SO invoice for when order type is SO to BROTHER printer. This works fine, however we trying to automate it to send it to the respective printer when quick process is over.

 

I followed this link below to start the process which is quite helpful.

 

I added my code on the top of my code as below to address IF else to see if this solves my problem. however I am receiving the error below. I am not sure how i progress from here. Any suggestion would be appreciated.

 

namespace PX.Objects.SO
{
  public class SOOrderEntry_Extension : PXGraphExtension<PX.Objects.SO.SOOrderEntry>
  {
    #region Event Handlers
  
  
public delegate void QuickProcessDelegate(SOOrder order);

[PXOverride]
public void QuickProcess(SOOrder order, QuickProcessDelegate baseMethod)
{
    baseMethod(order); // Run standard Quick Process logic

    if (order == null) return;

    string orderType = order.OrderType;
    string refNbr = order.OrderNbr;

    var reportParams = new Dictionary<string, string>
    {
        { "OrderType", orderType },
        { "RefNbr", refNbr }
    };

    string selectedPrinterID = orderType == "CSL" ? "Docket" : "Brother";

    var printSettings = new PrintSettings
    {
        PrintWithDeviceHub = true,
        DefinePrinterManually = true,
        PrinterID = selectedPrinterID
    };

    SMPrintJobMaint g = PXGraph.CreateInstance<SMPrintJobMaint>();

    // Fix: Pass a proper Guid? (null as nullable Guid)
    g.AddPrintJob("SO643000", printSettings, (Guid?)null, reportParams, CancellationToken.None);
}
  

    #endregion
  }
}

 

 

1 reply

Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • 15 replies
  • March 14, 2025

Attached Customisation


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