Hi all,
I’m well on my way to converting the external DLL we have to handle our process, however I’ve hit a snag when trying to send a BAQ report to the SystemTaskAgent from my custom code.
Here’s a little snippet of the code:
using (var bqReport = WCFServiceSupport.CreateImpl<Ice.Proxy.Rpt.BAQReportImpl>(_epiSession, Ice.Proxy.Rpt.BAQReportImpl.UriPath))
{
var bqDS = bqReport.GetNewParametersForReportId(BAQ_REPORT_ID);
string pnFilter = BuildPackNumFilter();
if (pnFilter != string.Empty)
{
try
{
bqDS.Tables["BaqReportParam"].Rows[0]["BAQID"] = "DL-EpiBoxingCust"; // ID of the BAQ Report Query
bqDS.Tables["BaqReportParam"].Rows[0]["SortBy"] = "";
bqDS.Tables["BaqReportParam"].Rows[0]["SortFields"] = "";
bqDS.Tables["BaqReportParam"].Rows[0]["ReportTitle"] = _reportTitle;
bqDS.Tables["BaqReportParam"].Rows[0]["Summary"] = false;
bqDS.Tables["BaqReportParam"].Rows[0]["Filter1"] = pnFilter; // Prebuilt XML BAQ Filter
bqDS.Tables["BaqReportParam"].Rows[0]["UserID"] = _userID; // Current Epicor UserID
bqDS.Tables["BaqReportParam"].Rows[0]["BAQRptID"] = "BAQEpiBoxCust2"; // Name of the BAQ Report
bqDS.Tables["BaqReportParam"].Rows[0]["ReportID"] = "BAQEpiBoxCust2"; // Name of the BAQ Report
bqDS.Tables["BaqReportParam"].Rows[0]["Option04"] = _packNum; // Pack Number
bqDS.Tables["BaqReportParam"].Rows[0]["AutoAction"] = "SSRSPRINT";
if (_printerName != string.Empty)
{
bqDS.Tables["BaqReportParam"].Rows[0]["PrinterName"] = _printerName;
}
bqDS.Tables["BaqReportParam"].Rows[0]["AgentSchedNum"] = 0;
bqDS.Tables["BaqReportParam"].Rows[0]["AgentID"] = "SystemTaskAgent";
bqDS.Tables["BaqReportParam"].Rows[0]["AgentTaskNum"] = 0;
bqDS.Tables["BaqReportParam"].Rows[0]["RecurringTask"] = false;
bqDS.Tables["BaqReportParam"].Rows[0]["RptPageSettings"] = _pageSettings;
bqDS.Tables["BaqReportParam"].Rows[0]["RptPrinterSettings"] = _printerSettings;
bqDS.Tables["BaqReportParam"].Rows[0]["ReportStyleNum"] = _styleID;
bqDS.Tables["BaqReportParam"].Rows[0]["WorkstationID"] = _workstationID;
bqDS.Tables["BaqReportParam"].Rows[0]["ArchiveCode"] = 0;
bqDS.Tables["BaqReportParam"].Rows[0]["DateFormat"] = "m/d/yyyy";
bqDS.Tables["BaqReportParam"].Rows[0]["NumericFormat"] = ",.";
bqDS.Tables["BaqReportParam"].Rows[0]["ProcessTaskNum"] = 0;
bqDS.Tables["BaqReportParam"].Rows[0]["DecimalsGeneral"] = 2;
bqDS.Tables["BaqReportParam"].Rows[0]["DecimalsCost"] = 5;
bqDS.Tables["BaqReportParam"].Rows[0]["DecimalsPrice"] = 5;
bqDS.Tables["BaqReportParam"].Rows[0]["GlbDecimalsGeneral"] = 2;
bqDS.Tables["BaqReportParam"].Rows[0]["GlbDecimalsCost"] = 5;
bqDS.Tables["BaqReportParam"].Rows[0]["GlbDecimalsPrice"] = 5;
bqDS.Tables["BaqReportParam"].Rows[0]["ReportCurrencyCode"] = "USD";
bqDS.Tables["BaqReportParam"].Rows[0]["ReportCultureCode"] = "en-US";
bqDS.Tables["BaqReportParam"].Rows[0]["RowMod"] = "A";
bqReport.SubmitToAgent(bqDS, "SystemTaskAgent", 0, 0, "Epicor.UIRpt.BAQReport;BAQEpiBoxCust2");
}
catch (Exception ex)
{
_errorDetected = true;
_errorMsg = ex.Message;
}
}
else
{
_errorDetected = true;
_errorMsg = "UNABLE TO GENERATE PACK NUMBER FILTER";
}
bqReport.Dispose();
}
Granted there’s a bunch of variables populated elsewhere, but what’s hanging me up is the AutoAction setting. Initially it was set to “Print” and I got this error:
Program Ice.Services.Lib.RunTask raised an unexpected exception with the following message: RunTask: Expected AutoAction to be either print, preview or generate.
Stack Trace:
at Ice.Core.SsrsReporting.ReportProcessorBase.ProcessReportPart(String reportLocation) in C:\_Releases\ICE\ICE3.2.300.12\Source\Server\Internal\Lib\TaskLib\SsrsReporting\ReportProcessorBase.cs:line 158
at Ice.Core.SsrsReporting.StandardReportProcessor.ProcessReportParts() in C:\_Releases\ICE\ICE3.2.300.12\Source\Server\Internal\Lib\TaskLib\SsrsReporting\StandardReportProcessor.cs:line 31
at Ice.Core.RoutingAndBreaking.ReportPersister.Persist(ReportInstanceInformation reportInstance, Func`2 reportsRenderer, Action`1 fillSysRptLstRow, Action`2 processReport, Func`3 filterTableAttachmentsFunc) in C:\_Releases\ICE\ICE3.2.300.12\Source\Server\Internal\Lib\TaskLib\RoutingAndBreaking\ReportPersister.cs:line 57
at Ice.Core.RptBase.ReportSsrsDatabaseBuilder.RenderUnroutedSsrsReport() in C:\_Releases\ICE\ICE3.2.300.12\Source\Server\Internal\Lib\TaskLib\RptBase\ReportSsrsDatabaseBuilder.cs:line 303
at Ice.Core.RptBase.ReportSsrsDatabaseBuilder.RunSsrsReportIfEnabled() in C:\_Releases\ICE\ICE3.2.300.12\Source\Server\Internal\Lib\TaskLib\RptBase\ReportSsrsDatabaseBuilder.cs:line 228
at Ice.Core.RptBase.ReportSsrsDatabaseBuilder.ProcessReportWithDataInPlace(Func`2 executeCommand, Func`2 executeReader, SqlObjectsCreated sqlObjectsCreated) in C:\_Releases\ICE\ICE3.2.300.12\Source\Server\Internal\Lib\TaskLib\RptBase\ReportSsrsDatabaseBuilder.cs:line 111
at Ice.Core.RptBase.ReportDatabaseBuilder.XMLClose() in C:\_Releases\ICE\ICE3.2.300.12\Source\Server\Internal\Lib\TaskLib\RptBase\ReportDatabaseBuilder.cs:line 93
at Ice.Core.RptTaskBase`1.XMLClose() in C:\_Releases\ICE\ICE3.2.300.12\Source\Server\Internal\Lib\TaskLib\RptBase\RptTaskBase.cs:line 216
at Ice.Internal.XA.DataBuilders.DatabaseReportDataBuilder.RunReportWithErrorHandling(ReportDatabaseConnectionHelper reportDatabaseConnectionHelper) in c:\_Releases\ICE\RL3.2.300.0\Source\Server\Internal\XA\XABaqRpt\DataBuilders\DatabaseReportDataBuilder.cs:line 70
at Ice.Internal.XA.DataBuilders.DatabaseReportDataBuilder.WriteData() in c:\_Releases\ICE\RL3.2.300.0\Source\Server\Internal\XA\XABaqRpt\DataBuilders\DatabaseReportDataBuilder.cs:line 44
at Ice.Core.TaskBase`1.StartProcess(Int64 instanceTaskNum, String outputFileName) in C:\_Releases\ICE\ICE3.2.300.12\Source\Server\Internal\Lib\TaskLib\TaskBase\TaskBase.cs:line 47
at Ice.Hosting.TaskCaller.InnerExecuteTask(IceDataContext newContext) in C:\_Releases\ICE\ICE3.2.300.12\Source\Framework\Epicor.Ice\Hosting\TaskCaller\TaskCaller.cs:line 98
at Ice.Hosting.TaskCaller.ExecuteTask() in C:\_Releases\ICE\ICE3.2.300.12\Source\Framework\Epicor.Ice\Hosting\TaskCaller\TaskCaller.cs:line 57
at Ice.Lib.RunTask.BpmFriendlyTaskLauncher.Run(String sessionIdPrefix, IceContext db, Action taskRunner) in c:\_Releases\ICE\RL3.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\RL3.2.300.0\Source\Server\Services\Lib\RunTask\RunTask.cs:line 577
So I tried setting it to “print” thinking it was case sensitive, but got the same error. Then I saw other people using “SSRSPRINT” so I tried that, but got the same error.
Any help is greatly appreciated. Thank you!