Print SSRS Report to EdgeAgent printer in SaaS environment

All, I’m hoping (anyway) that someone has encountered the following and has found a way through it.

We’re in a cloud environment and use the Edge Agent to accommodate SSRS printing to local networked printers - as I imagine most cloud folks do.

Using the great examples that have existed on this site, I’ve created lots of button-launched reports, but this is the first time attempting it in a cloud environment, and I’m having quite the time trying to get it to work.

So, I have a customized Job Traveler at Style 1003, and I’ve successfully packaged the service code necessary to launch the report into a Function. For testing, I use the 'AutoAction = SSRSPreview" setting and it works perfectly.

However, changing that to SSRSPrint (and supplying the Edge Agent printer name) generates an error in the System Monitor. I’m certain that I am missing some needed parameters, but I have no idea which.

Can you spot the error or missing param(s)?


using (var svcJobTrav = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.JobTravSvcContract>(context)) 
{ 
    Erp.Tablesets.JobTravTableset tsJobTrav = svcJobTrav.GetNewParameters();
    string strWkst = "PRT57";
    string prnName = @"Prt57@SRV-ISTEST2-EdgeAgent";
    if (tsJobTrav != null) 
    { 
        tsJobTrav.JobTravParam[0].Jobs = "001237-1-1";
        //tsJobTrav.JobTravParam[0].PrntAllMassPrnt = false;
        tsJobTrav.JobTravParam[0].PrinterName = prnName;
        tsJobTrav.JobTravParam[0].BarCodes = true;
        tsJobTrav.JobTravParam[0].AutoAction = "SSRSPRINT";
        tsJobTrav.JobTravParam[0].AgentID = "SystemAgent";
        tsJobTrav.JobTravParam[0].ReportStyleNum = 1003;
        tsJobTrav.JobTravParam[0].WorkstationID = strWkst;
        tsJobTrav.JobTravParam[0].SSRSRenderFormat = "PDF";
        tsJobTrav.JobTravParam[0].RowMod = "A";
       
        svcJobTrav.SubmitToAgent(tsJobTrav, "SystemTaskAgent", 0, 0, "Erp.UIRpt.JobTrav");
    } 
}

Errors…


System.NullReferenceException: Object reference not set to an instance of an object.

   at Ice.Lib.MessageHub.EdgeMessageHubSender.Print(Byte[] reportBytes, String printerName, String reportDescription, EpiPrinterSettings printerSettings, EpiPageSettings pageSettings) in C:\_releases\ICE\ICE4.2.300.0\Source\Server\Internal\Lib\Ice.Lib.MessageHub\EdgeMessageHubSender.cs:line 57

   at Ice.Core.SsrsReporting.PdfReportPrinter.Print(Byte[] reportBytes, String printerNameParameter, String reportDescription, EpiPrinterSettings printerSettings, EpiPageSettings pageSettings, Int64 sysTaskNum, Func`2 getSysRptLstRowSysRowID) in C:\_releases\ICE\ICE4.2.300.10\Source\Server\Internal\Lib\TaskLib\SsrsReporting\PdfReportPrinter.cs:line 69

   at Ice.Core.SsrsReporting.ReportProcessorBase.RenderReportForPrintOrEmailReport(RenderedSsrsReport renderedReport, Boolean serverSidePrint, Boolean ignorePageSettings) in C:\_releases\ICE\ICE4.2.300.10\Source\Server\Internal\Lib\TaskLib\SsrsReporting\ReportProcessorBase.cs:line 573

   at Ice.Core.SsrsReporting.ReportProcessorBase.ProcessReportPart(String reportLocation) in C:\_releases\ICE\ICE4.2.300.10\Source\Server\Internal\Lib\TaskLib\SsrsReporting\ReportProcessorBase.cs:line 168

   at Ice.Core.SsrsReporting.StandardReportProcessor.ProcessReportParts() in C:\_releases\ICE\ICE4.2.300.10\Source\Server\Internal\Lib\TaskLib\SsrsReporting\StandardReportProcessor.cs:line 34

   at Ice.Core.RoutingAndBreaking.ReportPersister.Persist(ReportInstanceInformation reportInstance, Func`2 reportsRenderer, Action`1 fillSysRptLstRow, Action`2 processReport, Func`3 filterTableAttachmentsFunc) in C:\_releases\ICE\ICE4.2.300.10\Source\Server\Internal\Lib\TaskLib\RoutingAndBreaking\ReportPersister.cs:line 58

   at Ice.Core.RptBase.ReportSsrsDatabaseBuilder.RenderUnroutedSsrsReport() in C:\_releases\ICE\ICE4.2.300.10\Source\Server\Internal\Lib\TaskLib\RptBase\ReportSsrsDatabaseBuilder.cs:line 359

   at Ice.Core.RptBase.ReportDatabaseBuilder.XMLClose() in C:\_releases\ICE\ICE4.2.300.10\Source\Server\Internal\Lib\TaskLib\RptBase\ReportDatabaseBuilder.cs:line 93

   at Ice.Core.RptTaskBase`1.XMLClose() in C:\_releases\ICE\ICE4.2.300.10\Source\Server\Internal\Lib\TaskLib\RptBase\RptTaskBase.cs:line 260

   at Erp.Internal.JC.JobTrav.RunProcess(Int64 instanceTaskNum, String outputFileName) in C:\_releases\ERP\ERP11.2.300.0\Source\Server\Internal\JC\JobTrav\JobTrav.cs:line 579

   at Ice.Hosting.TaskCaller.InnerExecuteTask(IceDataContext newContext) in C:\_releases\ICE\ICE4.2.300.10\Source\Server\Framework\Epicor.Ice\Hosting\TaskCaller\TaskCaller.cs:line 68

   at Ice.Hosting.TaskCaller.ExecuteTask() in C:\_releases\ICE\ICE4.2.300.10\Source\Server\Framework\Epicor.Ice\Hosting\TaskCaller\TaskCaller.cs:line 64

   at Ice.Lib.RunTask.BpmFriendlyTaskLauncher.Run(String sessionIdPrefix, IceContext db, Action taskRunner) in C:\_releases\ICE\ICE4.2.300.0\Source\Server\Services\Lib\RunTask\BpmFriendlyTaskLauncher.cs:line 63

   at Ice.Services.Lib.RunTaskSvc.InnerRunTask(Int64 ipTaskNum, Boolean suppressTransaction) in C:\_releases\ICE\ICE4.2.300.0\Source\Server\Services\Lib\RunTask\RunTask.cs:line 450

PageSettings?

Thanks @Olga . One of my failed attempts included the following (see the comments). I couldn’t get the formatting right, so I abandoned it.

    { 
        tsJobTrav.JobTravParam[0].Jobs = "001237-1-1";
        //tsJobTrav.JobTravParam[0].PrntAllMassPrnt = false;
        tsJobTrav.JobTravParam[0].PrinterName = prnName;
        tsJobTrav.JobTravParam[0].BarCodes = true;
        tsJobTrav.JobTravParam[0].AutoAction = "SSRSPRINT";
        tsJobTrav.JobTravParam[0].AgentID = "SystemAgent";
        tsJobTrav.JobTravParam[0].ReportStyleNum = 1003;
        tsJobTrav.JobTravParam[0].WorkstationID = strWkst;
        tsJobTrav.JobTravParam[0].SSRSRenderFormat = "PDF";
        tsJobTrav.JobTravParam[0].RowMod = "A";
        //tsJobTrav.JobTravParam[0].RptPageSettings ="Color=False,Landscape=False,PaperSize=[Kind="Letter" PaperName="Letter" Height=1100 Width=850],PaperSource=[SourceName="Automatically Select" Kind="FormSource"],PrinterResolution=[Kind="Custome" X=600 Y=600
        //tsJobTrav.JobTravParam[0].RptPrinterSettings = "PrinterName=\"" + prnName + "\",Copies=2,Collate=True,Duplex=Simplex,FromPage=1,ToPage=0";
        
        svcJobTrav.SubmitToAgent(tsJobTrav, "SystemTaskAgent", 0, 0, "Erp.UIRpt.JobTrav");
    }

Do you think this is where I need to focus? I know the commented section is a mess, but if that’s what’s missing, perhaps I can assemble the proper string - any suggestions?

EA is expecting both of them not null, so you have to figure it out

Gotcha. I was reading the REST help and the call to GetNewParams also runs the GetDefaults, which, I thought, populates all necessary fields leaving me to specify just the values I shared in the very simple code.
Since the preview ran without a hitch, I thought i had all that was needed; clearly not the case.
I will spend some time with these and see if I can get further. Thanks for your response.

1 Like

Is your network printer set up as an SSRS Printer in Epicor?

@jkane It sure is, John, and it works - for manual print jobs as well as APR initiated jobs. I’m still playing with the settings that Olga pointed out. My error message keeps changing as I adjust the report page, and printer parameter settings, so I may be onto something.

Well, this is frustrating. After including the Page and Printer settings parameters, the system now appears to be looking for a groupName. I see no reference to a groupName anywhere.

Has anyone seen the following error?

Code at present…

var context = Ice.Services.ContextFactory.CreateContext<ErpContext>(); 

using (var svcJobTrav = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.JobTravSvcContract>(context)) 
{ 
    Erp.Tablesets.JobTravTableset tsJobTrav = svcJobTrav.GetNewParameters();
    string strWkst = "PRT57";//Ice.Lib.Report.EpiReportFunctions.GetWorkStationID(svcJobTrav);
    //string prnName = "Prt57";
    string dquote = "\""; string dbakslash = @"\\"; string bakslash = "\\";
    string prnName = @"Prt57@SRV-ISTEST2-EdgeAgent";
    if (tsJobTrav != null) 
    { 
        tsJobTrav.JobTravParam[0].Jobs = "001237-1-1";
        tsJobTrav.JobTravParam[0].PrntAllMassPrnt = false;
        tsJobTrav.JobTravParam[0].PrinterName = prnName;
        tsJobTrav.JobTravParam[0].BarCodes = true;
        tsJobTrav.JobTravParam[0].AutoAction = "SSRSPRINT";
        tsJobTrav.JobTravParam[0].AgentID = "SystemAgent";
        tsJobTrav.JobTravParam[0].ReportStyleNum = 1003;
        tsJobTrav.JobTravParam[0].WorkstationID = strWkst;
        tsJobTrav.JobTravParam[0].SSRSRenderFormat = "PDF";
        tsJobTrav.JobTravParam[0].RowMod = "A";
                
        tsJobTrav.JobTravParam[0].RptPageSettings = "Color=False,Landscape=False,Margins=[Left=25 Right=25 Top=25 Bottom=25],PaperSize=[Kind=" + dquote + "Letter" + dquote + " PaperName=" + dquote + "Letter" + dquote + " Height=1100 Width=850],PaperSource=[SourceName=" + dquote + "Automatic Selection" + dquote + " Kind=" + dquote + "AutomaticFeed" + dquote + "],PrinterResolution=[Kind=" + dquote  + "Custom" + dquote + " X=600 Y=600]";
        
        tsJobTrav.JobTravParam[0].RptPrinterSettings = "PrinterName=\" + prnName + \",Copies=2,Collate=True,Duplex=Simplex,FromPage=1,ToPage=0";
        
        svcJobTrav.SubmitToAgent(tsJobTrav, "SystemTaskAgent", 0, 0, "Erp.UIRpt.JobTrav");
    } 
}

I recently saw that in MetaUI Test Print - there PrinterID field from SysPrinter was used instead of NetworkPath and EA cannot find the instance.
where is string prnName = @“Prt57@SRV-ISTEST2-EdgeAgent”; is taken from?

1 Like

OMG!!! :exploding_head: :exploding_head:

I have this same exact issue with Job Traveler. I had a ticket open with support for months and they just ended up closing it. I did not put up a stink because it is only happening to my user account.

I recommend publishing your report and asking someone else to run it and see what happens.

2 Likes

I just checked the System Monitor and I tried printing one 2 days ago.

image

1 Like

Wow!!!

1 Like

Same thing happens to me when I try to Network Print the Job Traveler. And it only happens with that report.

image

1 Like

So, you’re printing via BPM (APR it looks like) and I’m printing via Epicor Function - both server side. Hmmmm.

1 Like

looks correct. it takes name after @ as EdgeAgentID.

1 Like

I’m not sure where to turn next.
@jkane , just to REALLY scramble the brain, I’m able to print the report via APR/BPM. So it can’t be a specifically server side problem. Aaaugh!!!

Is the report published so that another user could try printing it? I have found that the issue is user based.

The report style is ‘published’ and is printed via EFx (the function library IS published) via button press (customization on ABCCode)
I’ll have someone else click the button, but I’m not optimistic.

I had a colleague click the button and the system monitor reports the same error. So that didn’t seem to affect things, although I appreciated having SOMETHING to try.

Looking at the error message, it looks like there’s some sort of hand-off taking place, with a server process looking for that groupName argument…