That you wouldn’t be able to do from a BPM. You would need to find a way to print it from the client to do a trace. What you can do is enable source generation for BPMs, save your BPM, go to the server BPM sources folder and see what they are doing.
I created a quick BPM for test. Using PackSlip report and the settings below
It generates code like below in that folder I referenced earlier. Looking at it, there are way easier ways but I don’t know what will work in your situation.
private void A001_AutoPrintAction()
{
var reportParamTS = new Erp.Tablesets.PackingSlipPrintTableset();
var reportParamTable = reportParamTS.PackingSlipParam;
var reportParamRow = new Erp.Tablesets.PackingSlipParamRow();
reportParamTable.Add(reportParamRow);
int rowIndex = 0;
Ice.Lib.Trace.AutoPrintTrace rootAutoPrintTracer = new Ice.Lib.Trace.AutoPrintTrace();
rootAutoPrintTracer.AddRootTraceMessage("Processing AutoPrint action for Report 'PackSlip', Style 'Standard - SSRS'");
rootAutoPrintTracer.AddToTraceHandler();
rootAutoPrintTracer.AddSettingTraceMessage("PrintSchedule", "Queue");
rootAutoPrintTracer.AddSettingTraceMessage("PrintAction", "AutoPrnt");
Ice.Lib.Trace.AutoPrintTrace rowSpecificAutoPrintTracer = null;
foreach (var primaryTableRow in this.ttABCCode.Where(r => (!r.Unchanged() || (r.Unchanged() && !ttABCCode.Any(r1 => r1.SysRowID == r.SysRowID && r1.RowMod != r.RowMod)))))
{
rowSpecificAutoPrintTracer = new Ice.Lib.Trace.AutoPrintTrace(rootAutoPrintTracer);
rowSpecificAutoPrintTracer.AddRootTraceMessage(null, "ProcessRow");
rowSpecificAutoPrintTracer.AddRootToParent();
rowSpecificAutoPrintTracer.AddRowTraceMessage(rowIndex, primaryTableRow.SysRowID);
SetUIBasedReportParameters_A001_AutoPrintAction(reportParamRow, primaryTableRow);
reportParamRow.AutoAction = "SSRSPrint" ;
reportParamRow.ReportStyleNum = 2 ;
reportParamRow.WorkstationID = Session.TaskClientID?? string.Empty;
if (reportParamTable.Columns.Contains("ReportID"))
{
reportParamRow["ReportID"] = "PackSlip" ;
}
reportParamRow.TaskNote = "";
reportParamRow.SSRSRenderFormat = "PDF";
string printerName = "\\\\server\\printer\";
string printerSettings = "PrinterName=\"\\\\server\\printer\",Copies=10,Collate=True,Duplex=Default,FromPage=1,ToPage=0";
string pageSettings = "Color=True,Landscape=False,AutoRotate=False,PaperSize=[Kind=\"Letter\" PaperName=\"Letter\" Height=1100 Width=850],PaperSource=[SourceName=\"FormSource\" Kind=\"FormSource\"],PrinterResolution=[Kind=\"Custom\" X=600 Y=600]";
reportParamRow.PrinterName = printerName;
reportParamRow.RptPrinterSettings = printerSettings;
reportParamRow.RptPageSettings = pageSettings;
rowSpecificAutoPrintTracer.AddSettingTraceMessage("PrinterName", printerName);
rowSpecificAutoPrintTracer.AddSettingTraceMessage("PrinterSettings", printerSettings);
rowSpecificAutoPrintTracer.AddLinqRowTraceMessage(reportParamRow, "ReportParameter");
if (String.IsNullOrEmpty ("Erp.Contracts.PackingSlipPrintSvcContract"))
{
Epicor.Hosting.Trace.ServerLog.WriteTraceMessage(Epicor.Hosting.Trace.WellKnownTraceFlags.BpmTrace, "BPM.AutoPrint", () =>"Report class name is empty" );
throw new Ice.Common.BusinessObjectException("Report class name is empty");
}
var reportService = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.PackingSlipPrintSvcContract>(Db, true);
if (reportService == null)
{
throw new Ice.Common.BusinessObjectException("Report service 'Erp.Contracts.PackingSlipPrintSvcContract' not available");
}
// Submit to agent (Queued)
try
{
// Pass an agentTaskNum of zero to get a new task record created.
// Pass an agentSchedNum of zero to use the default 'Now' schedule.
reportService.SubmitToAgent(
reportParamTS,
agentID: "SystemTaskAgent",
agentSchedNum:0,
agentTaskNum:0,
maintProgram:"Erp.Services.Rpt.PackingSlipPrint");
rowSpecificAutoPrintTracer.AddTraceMessage("Report submitted", "QueueMode");
}
catch (Exception ex)
{
Epicor.Hosting.Trace.ServerLog.WriteTraceMessage(
Epicor.Hosting.Trace.WellKnownTraceFlags.BpmTrace,
"BPM.AutoPrint",
() => "SubmitToAgent failed. Ex: {0}" + ex.ToString());
// handle errors here
throw new Ice.Common.BusinessObjectException("Failed to submit autoprint report. Error: " + ex.ToString());
}
rowIndex++;
}
}
private void SetUIBasedReportParameters_A001_AutoPrintAction(Erp.Tablesets.PackingSlipParamRow reportParamRow, ABCCodeTempRow primaryTableRow)
{
reportParamRow.PackNum = Convert.ToInt32("0");
reportParamRow.PrintingOptions = Convert.ToString("S");
reportParamRow.AssignLegalNumber = Convert.ToBoolean("False");
reportParamRow.EnableAssignLegalNumber = Convert.ToBoolean("False");
reportParamRow.StyleNumExt = Convert.ToInt32("1008");
reportParamRow.EnableIncludePCID = Convert.ToBoolean("False");
reportParamRow.IncludePCID = Convert.ToBoolean("False");
reportParamRow.DraftMode = Convert.ToBoolean("False");
reportParamRow.IncludeInventoryAttributes = Convert.ToBoolean("False");
reportParamRow.ArchiveCode = Convert.ToInt32("0");
reportParamRow.DateFormat = Convert.ToString("m/d/yyyy");
reportParamRow.NumericFormat = Convert.ToString(",.");
reportParamRow.PrintReportParameters = Convert.ToBoolean("False");
reportParamRow.SSRSEnableRouting = Convert.ToBoolean("True");
reportParamRow.DesignMode = Convert.ToBoolean("False");
}